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/
Related
For many images, this code works fine to convert a PNG image to JPG:
Thumbnails.of(pngIn)
.outputFormat("jpg")
.scale(1.0)
.toFile(jpgOut);
But for this specific image:
the code results in an all-white JPG image. If someone can point me to the right way of doing things in Thumbnailator, I would very much appreciate it. Cheers!
EDIT: Well, something in the image upload / download process makes things work for the attached image! (The downloaded image is 50K while the original image is 41K, so clearly there's some funkiness going on there.) But I promise that the original PNG really does not work.
EDIT 2: This link to Google images can be used to download the 920x900 PNGWing image (41K) on the right side of the page.
The above syntax seems to be correct for converting PNG to JPG. The problem is that when the referenced image is read into a BufferedImage object, the image's type is BufferedImage.TYPE_BYTE_BINARY. While such images can be 1, 2, or 4-bit images, Thumbnailator doesn't handle 2- or 4-bit images correctly, essentially assuming that the image is a 1-bit image.
In short: the syntax is correct, but there appears to be a Thumbnailator bug that hinders successful processing of some PNG files.
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 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.
I realize that PNG is normally the web standard, but I might have a bit of a unique situation. I'm building an app that downloads lots of images from a server. The download needs to be as quick as possible, especially over 3G connections. I've been looking into the best compression for the images on the server. Ideally, every image I use can be quickly resized for the app using a drag and drop converter of some sort. When I convert one of the images to a PNG, the file size is around 130KB. When converted to an acceptable JPG quality however, the file size comes in at well under 50KB. Should I use JPGs in the application?
Thanks in advance,
It actually depends on the type of images.
The basic rule is to use JPEG for photos and PNG for everything else.
Why is it so?
JPEG compression is designed for photos - photos can handle lossy compression. On the other hand, PNG is compression designed for images which have similar pixels close to each other (straight lines, areas filled with one color, texts, etc.). If you try to use JPEG on an image which is not a photo, you'll be surprised - it won't look very good.
PNG is a standard - but for icons, backgrounds, patterns etc; not for photos.
Yes you can use jpg. You will not encounter any problem. It is a tradeoff between quality and size. Jpeg is usually smaller because it is compressed so as to reduce size. Png is lossless compressed.
I have made applications that use both png and jpeg and they both work like a charm.
EDIT: You can also check out this link PNG vs JPEG
PNG images are huge in size, use JPG as long as it's possible (when you don't need transparency)