I don't use this so much anymore as pornographic images don't really stay in my head and stir up cravings... but here is something I used years ago when the images used to trigger cravings..
This is something you should ideally do while you are 'sober'.
Focus your attention on something peaceful. It could be a peaceful place, a picture of something beautiful like a sunset, or whatever. Doesn't matter if it's real or imagined, since your brain doesn't tell the difference anyway.
Make sure you do this with a playful attitude, like the way children do. Take the a few seconds to do each of these steps:
1 - Take a deep breath all the way in and out. At the end of the breath, slowly say the word 'peace' to yourself in a peaceful manner
2 - Now imagine seeing something peaceful. See what it looks like
3 - Hear what it would sound like
4 - Feel what it would emotionally feel like to be there
5 - Also get physical: Breathe the way a peaceful person would breath
6 - And change your posture to a peaceful one. Sit or stand the way you would if you were at peace
7 - Again, say 'peace' to yourself slowly, and recall what you see, hear, feel emotionally, and get physical with it.
8 - Repeat step 7 (or 1-7) a few times to reinforce this feeling
You've just created an experience which you can use to your advantage.
Whenever your mind stirs up a pornographic image, interrupt it with a deep breath in, out and say 'peace' in the exact same manner and again, get physical: Sit or stand the way you would if you were acting the role of someone at peace, breathe like a peaceful person.
This will cause your mind to focus on peace. It may not immediately remove the pornographic image if the 'peace' isn't strong enough (though it often does, or at the very least it weakens the pornographic image), so just repeat the word 'peace' several times over and see the peaceful image, and recall what you heard and felt (and get physical too). This will reprogram/recondition your mind to focus on peace instead of the pornographic image. Remember, you must say it the way you did in the above steps.
With enough repetition, the pornographic image will cease, or it will almost automatically trigger your 'peace' response which is still better than trying to 'fight' the pornographic image. Basically, this is a way to 'hijack' your brain so that every time the unwanted image pops up, it leads you to peace, which eventually fades out the pornographic image altogether.
Whereas the pornographic image would lead people to beat themselves up as they're trying so hard to remove it, using the above technique allows you to weaken or remove the image altogether which leaves you in a far more resourceful state. Hope this helps!