S ranked photos are only possible if you take a well staged photo while the pp (perfect photo) icon is visible.
This is all explained inside the tutorial files and during the photography basics tutorial gameplay.