I seem to be having issues replicating the iOS png optimizations that xcode makes. Our app allows users to update content via an asset server by comparing the checksums of the files stored in the bundle with those on the server. Before any pngs are uploaded to the server they are subjected to the iphoneos-optimize script inside the xcode developer directory (Stack Overflow post). The trouble is that the checksum performed (both by the server and the device) on the pngs produce different results.

It is worth mentioning that this is tested on the device and not the simulator (which doesn’t crush the pngs). Also the visible results are the same it is merely the checksum that is different.

2 Responses to “iOS – pngcrush discrepancy”

I created a test in which I uploaded the bundle .png from device to our server so we could analyse the image more thoroughly. When I opened the .png file I could actually see the image, which suggested it had not been mangled by the XCode build process (as it swaps the bytes etc). I then disabled the png compression from the build settings within XCode and tried again. The image sent to the server this time was pngcrushed and the checksum of the file matched the image I crushed manually. It would suggest that the build setting for XCode 3.2.6 may be backwards. I then tested on a colleague’s machine running XCode 3.2.5 and the setting worked as expected; producing a crushed image when the compression flag was set.

I tried googling for the issue but could not find any bug/issue reports on the subject. However the evidence suggests it is an XCode issue. It would be good to receive confirmation on this from another party.