Generally, harassment is a course of conduct over a period of time, not a one-off. The bar for a one-off encounter being harassment of any kind is high, with good reason.
That reason, to me, is that any reasonable person should be robust enough that all but the most serious, malicious communication should be something they can shrug off without much ill effect if it's a single isolated message. Getting a picture of a wanking cartoon character and a disparaging message isn't going to be pleasant for most people, sure, but if that's it?
The logic behind punishment for sexual harassment is not - or should not - be any different from the logic behind punishment for non-sexual harassment; it should be proportional to the harm caused, and it should take the same standard of a "person of reasonable firmness" or whatever the legalese is.