Base functionality for reading PNG image files.