How does squinting alllow one to see clearer pictures? What are the harmful effects?
I think there is more to it than the pinhole effect. Have you ever noticed that you can make out faces by squinting your eyes at a pixelated video of someone.
This is an optical pinhole effect. If the amount of light passed through the lens decreases, the sharper the image is at the focal point. For a camera this is accomplished by increasing the f stop (f22 is a smaller aperture size than f6 — f-stop is an inverse number). For the eye the iris will dilate (get larger) or contract to be smaller. In very bright light, you can cut down on large amounts of light coming in by squinting, which creates a slit in front of the eye lens.
In photography this increases the "depth of field". Which is to say that more objects are in focus and sharp. It works the same for our eyes of course.
In this image you can see as the aperture is smaller, any given point on the focal plane (right hand line) receives light from a smaller angle (i.e. from less of the image field).
I am not a physicist, but that's a first order explanation @Luke reminds me that there was a question about whether squinting is harmful. There is another reason that we squint. If we are nearsighted or if we are getting older, we have a tendency to squint not because there is too much light coming into our eyes, but because our lenses are not focusing very well. Is it harmful to strain our eyes? Maybe, but it won't kill you. Reading glasses won't either.