It’s interesting how sin can sneak up on you. Sin comes in a very attractive package, but before you know it, you’re caught in its’ snare. From your comments I don’t believe the sin was a mortal one, but instead of agonizing over this, try looking at sin from another perspective.
While the Catholic Church teaches that sin is either venial or mortal (deadly), when you realize that all sin is an abomination to God, you will begin to see sin in its’ true light. It is not that you committed a venial or mortal sin, but that you just stepped out of relationship with God.
But the Good News is that, as long as you sincerely repent (tell God you’re sorry) and go to confession, you will be forgiven. But to really turn away from the sin, you need to not go there. If you know that looking at certain pictures will lead you to sin, don’t even start looking at the pictures. Because of our weak human nature, we have to fight against ourselves and most times, we end up losing. The better thing to do is to be aware of your weaknesses and stay away from the situation altogether.
If you’re on a diet, you don’t leave unhealthy snacks in the house because at some point they’ll become a source of temptation (ask any dieter). If you have an addiction to alcohol, you probably shouldn’t be working in a bar either (putting yourself in a tempting situation). Can you see that when we put ourselves in a position where we might sin, we end up committing that very sin? It’s not a question of willpower. Because we’re human, we’re prone to sin. It’s that simple.
Work on developing a close relationship with God. Try to hear His voice–when you’re in church, when you have a problem, when you need help. God is always there, but you have to figure out how to hear Him. Also, call upon the Holy Spirit to give you the strength and courage to overcome sin. If you pray before a situation, He will give you the grace you need to overcome the sin. For God says, “My grace is sufficient for you.”
God Bless