Improved PNG parsing