mahrams

Looking at photos

Q:

1. I wanted to ask whether it is sinful to look at photographs? Or can we can look at photos of our mahrams?

2. We are not allowed to look at non mahrams. Does it mean that we cannot look at him even at a glance for once? For eg. We need to see for once, so as to know who is our brother in law, or neighbour, uncle i.e. just for recoginition purposes.