Praise be to Allaah.
With regard to the ruling on looking at naked pictures, please see question # 8861.
With regard to your committing the “secret vice”, your looking at something haraam led you to commit another haraam action. Perhaps it may lead you in the future to commit one of the major sins – Allaah forbid – such as fornication or homosexuality.
Doing the “secret vice” is haraam. It is important that you see question no. 329.
What you have to do is to repent to Allaah from the sins that you have committed, and keep away from every haraam thing that may provoke desire. You will not find any better means than fearing Allaah, then protecting yourself by means of marriage. If you cannot get married, then you have to fast, for it will be a shield for you. This is the advice of the Prophet SAWS (peace and blessings of Allaah be upon him) to young men. Try not to be unoccupied as far as you can, and seek the help of Allaah. And Allaah knows best. May Allaah bless our Prophet Muhammad.
Al-Akhlaaq (characteristics) – al-Akhlaaq al-Madhmoomah (Blameworthy characteristics) .
Sheikh Muhammed Salih Al-Munajjid