I faced an 'PNG crush' error because of 'Default-568#2x.png'. When I unchecked compress PNG files option in the project (Project -> Target -> Build Settings -> Packaging -> Compress PNG Files) I got the error resolved.
So My Questions are:
Why we are using 'PNG crush' in Xcode?
What happen is we unchecked that option(other that compressing the png).
What could be the reason for that error?
Thanks in Advance.
Chahal
PNG crush is an optimiser for png image files. It shrinks the size of the PNG IDAT datastream by trying different levels of compression.
You might be getting an error because your Default-568#2x.png isn't really a PNG file, but some other image format saved with a .png extension.
Related
Every uploaded png file to CloudPebble gives me a Uncaught Error: Incomplete or corrupt PNG file error during an app run-time.
I tried to save png file in different formats, compression, no compression, gray scale, indexed Pebble colors, etc.
Cannot get it working. PNG file is simple black and white icon. Followed tips in the documentation for Image Resources.
What can be wrong?
It seems in my case it was a CloudPebble error that has been fixed. My app compiles now no problem.
For tips on images for pebble check https://developer.getpebble.com/blog/2014/10/29/Displaying-remote-images/
I am developing an app that downloads a png image from internet and displays it. For some reason gbitmap_create_from_png_data() fails to load most images with following error message:
[ERROR] gbitmap_png.c:49: PNG memory allocation failed
[ERROR] gbitmap_png.c:99: Failed to load PNG
I doubt that I am out of memory. I say this because I have tried loading very small images i.e 4Kb in size and they still fail. On the other hand some images, although 16kb in size, load successfully. Other confusing thing is that the same images that fail to load using gbitmap_create_from_png_data() load successfully using gbitmap_create_with_resource() if I add them as image resources to my app. So images are correctly formated for Pebble. The downloaded images are exactly the same size as the ones I have locally so I doubt the image data gets corrupted.
Successful image: http://brucedalemansion.com/images/baby_16.png
Un-Successful image: http://i.imgur.com/CUJwSU7.png
The un-successful image contained a transparency chunk (tRNS) with 0 entries. For the palette chunk (pLTE), this would be invalid by the specification. For the transparency chunk, it may be considered valid... as the PNG specification states "[equal] or less tRNS entries than there are palette entries".
Since some tool is making PNGs with this issue, I am adding support to our PNG decoder for it.
I would be interested in what tool made that PNG image.
Matt from Pebble
I am using GraphicsMagick and currently running into the following issue:
when executing
gm identify <filename>.png
I'm getting the following error:
gm identify: CgBI: unknown critical chunk (<filename>.png)
gm identify: Request did not return an image.
This is a png extracted from an iPhone. Though it may not contain an actual image, I do need the image info.
Tried opening it with several editors:
The png does open in Paint with the right height x width but as completely white.
The png does not open in GIMP, saying it might be corrupted
The png does open in Paint.net with the right height x width as a transparent image
Using the debug parameter provides the following line:
libpng-1.5.14 error: CgBI: unknown critical chunk
I'm running the latest GraphicsMagick (1.3.18).
Does anyone know what's going on, and how I will be able to get this to return the image info?
Thanks in advance.
The PNG you are trying to read has been run through Apple's "Xcode" version of pngcrush, which creates files that aren't PNGs. I believe Apple's pngcrush also has the capability of undoing the damage and more-or-less restoring the original PNG, using the "-revert-iphone-optimizations" option, although it's not mathematically possible to restore the color channels exactly for transparent or semitransparent pixels.
set in xcode build setting this flag to NO
Remove Text Metadata From PNG Files = NO
I would like to compress png files on my site. I found ImageOptim program. For jpeg files it works great, but when I compressed png files it displayed incorrectly on the site (part of the picture is cut off).
My question is how to make it work in browsers? I see that ImageOptim uses several tools for png compressing(PNGOUT,OPTIpng etc).Maybe I should set some specific tool?
I recommend using JPEG & PNG Stripper.
You can either drag and drop your image files to the GUI or use it as a command line tool.
Is it possible to set an iPhone Xcode project to skip the 'CompressResources' build step?
Specifically, I want to skip the stage where it runs pngcrush on all of my .png files, many of which don't survive the experience in a form which my app can read.
Edit: the version of pngcrush used creates png files which contain a non-standard 'mandatory, private' chunk which explicitly prevents decoding. I've modified my png reader to handle these files, but I'd still like a per-project method of skipping this step. One of the other side effects of pngcrush is that it doesn't save the colour value of transparent pixels, so alpha-ed textures show fringing at smaller mip levels.
The iphone png format is described here: https://web.archive.org/web/20110519164905/http://modmyi.com/wiki/index.php/Iphone_PNG_images. In short,
Skip the CgBI chunk
Skip the zlib headers
Swap BGR to RGB channel order
Edit: It appears it also premultiplies the alpha, so:
Divide by alpha
You can add "IPHONE_OPTIMIZE_OPTIONS=-skip-PNGs" to your project settings to prevent the png mangling, but be careful with it, you might need to optimize the icon and Default.png separately then.
The iphoneos-optimize script converts PNG files into a nonstandard format that is optimized for display on the iPhone. The script will convert any files with the png extension that it finds inside your app bundle.
I had a similar problem, and solved it by giving my file the extension _png (i.e., prefixed an underscore). iphoneos-optimize ignored it and left it a regular PNG file. If you can deal with it that way, it's probably a lot safer than mucking about with the build scripts.
Open build settings
Under "packaging" choose Compress PNG files
Choose "NO"
If you look at the build output you'll see that the CompressResources step runs the script /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/iphoneos-optimize. This appears to be just a shell script that runs pngcrush and compiles plists into binary format. You could probably modify this script to not run pngcrush.
Note that someone in this thread noticed that if they did not run their icon file through pngcrush it wasn't showing up on the phone.
Interestingly, the version of pngcrush in the directory of the script has a -iphone argument. Anybody know if this is standard or something Apple just ships with their build of it?
That might be another issue all together. In many cases the problem has to do with naming and can be solved very easily.
read this:
http://cocoapi.wordpress.com/2009/03/22/iphone-images-not-appearing-in-real-iphone-this-is-why/