Ta is generally used for feminine nouns and ton for masculine nouns… but before a vowel sound, ta is never used. In French hiatuses are commonly avoided by resorting to elisions or other grammatical artifices.
Thus, “ton image”, pronounced
/tɔ̃.n‿i.maʒə/, just like “ton idée”, “ton ubiquité”, “ton histoire”…
Similarly the possessive articles ma and sa become mon and son before vowel sounds.
In addition to Stéphane’s answer, I would say that it is very similar to the “n” in “an” before a noun in English.
You say “an action” or “an elevator” because it’s easier to enunciate than “a action” or “a elevator”.