Here is one strategy for handling it: Every time one of those impure images pops into your mind, take that as an reminder to pray for that person’s conversion. Pray specifically for her (or him). That way, instead of contributing to their fall, you could impact their salvation. This makes up for the times you have lusted after the person but will accomplish even more. If you persevere in this practice, I would imagine that the thoughts subside considerably.
Other than this, continue with your prayer life and remain pure in your day-to-day relationships. Also, deepen your devotion to Mary. We need to have our image of womanhood redeemed, and praying a daily rosary is an ideal way to begin this reconstruction. The remedy for pornography is to understand the dignity of womanhood (and manhood) and the truth about your call to love. Persevere in this practice, and your lust will be transformed into love.
In the meantime, stay strong. Resisting these temptations will foster in you the virtues that will help you to become most fully who God created you to be.