X-Ray radiation penetrates different materials at various rates. The X-Ray machine sees the variations in that density. They see everything that's in your bag. They also pick up on metal and drugs.
It depends on which kind. The small ones that you put your cary-ons through to get to the gate usually won't, but the big ones that you put your checked bags through probably will destroy your film....