13

I have some HTML content pages in an app and I'm using a UIWebView to display them. Some of these pages have a PNG image in them that is generating the following message in the debug console in xcode:

ImageIO: PNG invalid PNG file: iDOT doesn't point to valid IDAT chunk

The image still displays and looks correct. Also this only happens when I run the app on an iPad (3rd generation). My iPhone 4 doesn't display this message.

My first thought was that it was caused by a ~ character in the filename (I've added the ~ipad tag to the filename). However, removing the ~ character doesn't have any effect.

I've done a google search but I only get 3 results. 2 of them are in Chinese that doesn't seem to be translated well by Google's translater. The other results seems to be someone with the same issue as me, but no responses to his post.

Blazer
  • 14,259
  • 3
  • 30
  • 53
kinadian
  • 238
  • 1
  • 3
  • 11

6 Answers6

12

Had the same problem. Solution: use "color sync utility" which is a standard program, you can load from launchpad. Open the png file and save it with the utility.

mochasoft
  • 159
  • 2
  • Did either of you have to do anything other than just open the PNG file and re-save it? I gave this a try (with a Clean before a rebuild) but I still get the message in the debug console. @btype – kinadian Aug 31 '12 at 14:41
  • Nope, just open and re-save. In my case the image was displayed only on half the screen. – btype Sep 01 '12 at 15:13
  • I opened with color sync, saved it, and I still get the error. This is the image I used: http://lcolumbus.files.wordpress.com/2012/10/big-data-drives-rapid-changes.jpg – Heath Borders May 20 '13 at 21:45
  • 1
    I have hundreds of assets. How do I tell which file has the problem? – jjxtra Dec 16 '13 at 07:36
4

'cleaning' the project (xcode menu path : product -> clean) solved this exact issue for me.

Resaving the .png with a new name did not.

Image did appear in the simulator but not on the test device (ipod touch 5th gen.)

Very large image 4000 x 4000

mzimm
  • 51
  • 1
2

Strangely, I had the exact same issue just about an hour ago. I didn't find a particular reason for why it was failing, but I think I was able to "fix" the image to make it display properly and not throw an error.

I just opened it in Preview and exported a new PNG file from the source. Once I replaced the bad image in my project file with the newly created one, I cleaned, compiled and it worked as expected.

Hope it's as easy as that for you...

brainfree
  • 817
  • 1
  • 8
  • 15
1

You may want to check you don't have another file with the same name in another directory. That is what caused this error for me .. (duplicate Default.png)

KeDaJo
  • 11
  • 1
  • I had a similar problem. I had revised an image. I first deleted the old image from the project and then added the revised one in. When testing I got this error and the "new" image would not display. I cleaned the project and the error was resolved and the image was displayed. – larick Aug 29 '13 at 21:28
1

I had the same problem with my app.It turn out that the images that the user was uploading to my server and edited with php +imagemagik where striped out.I was using the following command to edit the uploaded image:

convert $uploadfile -resize 300x300 -quality 30 -strip $uploadfile

When i removed the -strip parameter the error was disappeared !

Theodoros80
  • 796
  • 2
  • 15
  • 43
-1

Same problem here.
1 - Close XCode;
2 - Open the image in Photoshop;
3 - Re-save ( replace the same image ) with 80% quality;
4 - Open XCode, clean it CMD + SHIFT + K;
5 - Build it in your device again;

Very simple and work for me.
And for you ?

Daniel Arantes Loverde
  • 2,317
  • 2
  • 28
  • 41