PNG re-work: handle libpng 1.5 correctly