Apr 28, 2012
The New iPad and indexed PNG
I discovered a strange bug with indexed png on the new iPad (aka iPad 3) and I wish to share my knowledge.
The problem was the strange line at the bottom of the image on retina (@2x) image in indexed png format. Here is the graphical explanation of a problem:
The black line is not a part of image itself; it is an artifact of the New iPad drawing subsystem (CoreGraphics?). The worst thing that in the Simulator everything looked fine, and I have no the New iPad to test on… So some time passed before I figured out what was happening. I replaced images by RGB png (thank you, ImageMagick!) and everything was OK.
To convert indexed png into RGB png install ImageMagick (via ports):
$ sudo port install imagemagick
and use script (it takes all PNGs in the current directory, converts them into RGB and also removes alpha channel by making background white):
#!/bin/bash for f in *.png do filename=$(basename "$f") extension=${filename##*.} filename=${filename%.*} echo converting ${filename}.$extension mogrify "./${filename}.$extension" -type TrueColorMatte -background white -flatten +matte -type TrueColor -define png:color-type=2 -depth 8 done