GIF images don't work on android device builds - Bug?

5 replies [Last post]
duneunit
User offline. Last seen 4 years 23 weeks ago. Offline
Joined: 31 Oct 2010

I've got a Samsung Galaxy SII. When I compile and install a very simple corona (3 lines of code, below) everything works in the simulator. It works on the iPhone, too. But on my Android phone, when I try to launch it, it says: "Error This application has been corrupted". Here's the code:

mapImg = display.newImage("map.gif")
mapImg:setReferencePoint(display.TopLeftReferencePoint)
mapImg.x, mapImg.y = 0,0

Now, I changed the image from a .gif to a .png, and everything works fine again.

Curious, I searched everywhere in the docs and don't see anything that says GIF images aren't supported on Android. And since it works fine on iOS, why would I assume it is different on Android? So I then tried saving my "map" image out as a GIF again. Maybe it must be a full color 256 gif, not just 32 or 16 colors? Maybe "convert to sRGB" should not be checked when exporting. maybe it should. I tried a lot of combinations. Still no luck.

So, question #1: Are GIF files not supported on Android? And if so, then question #2: Why isn't this in the documentation?

Or is this a bug of some kind?

Replies

Sven.Lua
User offline. Last seen 33 weeks 5 days ago. Offline
Joined: 17 Jun 2011

http://developer.anscamobile.com/content/display-objects#Loading_an_Image

AFAIR everywhere is described: PNG and JPEG is supported. No need to write: GIF, TIFF, PIFF, TGA, PCX, PSD, PDS, RNB, NPD, XXL, ... isn't supported.

Convert your GIFs to PNGs as you've done.
Don't use indexed or grayscale PNGs.

And you will be happy on iOS and Android.

Go further and try to see the advantages of PNG over GIF. Forget about color reduced Images below 24 bit. This are special cases mostly unwanted these days and are not supported by Corona SDK.

duneunit
User offline. Last seen 4 years 23 weeks ago. Offline
Joined: 31 Oct 2010

Sven-

Yes, PNGs are better. I've got one of those exceptions where every little bit of memory helps, so I opted to save 300k with 3 GIFs.

Thanks for the link. Good to know for sure. That said, the doc you pointed to is more a part of the "how to" documentation. I looked thru the actual API reference docs for "dislay.newImage()" and "display.newImageRect()" and it doesn't make a single mention about JPGs and nothing about PNGs save the fact that PNGs shouldn't be indexed or use ICC profiles. It may be mentioned in a lot of places, but not in the reference docs, which is the #1 place it this kind of info should be, IMO.

And uh, yeah... kind of obvious Ansca doesn't need to say TIFF, TGA, PCX, PSD, etc aren't supported, don't ya think?... Tho I wonder if they will come out with support for Amiga HAM6 files soon? ;-)

Again, I appreciate the link!

peach pellen
User offline. Last seen 6 years 35 weeks ago. Offline
Alumni
Joined: 12 Apr 2011

Tho I wonder if they will come out with support for Amiga HAM6 files soon? ;-)

Shall add this to the feature request pile?

Peach ;)

Matthew Pringle
User offline. Last seen 36 weeks 5 days ago. Offline
Joined: 23 Feb 2010

There are PNG processors that will strip out extra info in a PNG. I've found with large images this can save a good 50K. Also ensure you save you PNG without transparency ( if it doesn't need it ) as that also takes the file sizes down a little.

Without an Amiga chipset you can't actually display a HAM6 images, its more than just a file format. Saying that however, its also outdated so I would say HAM8.

open768
User offline. Last seen 18 weeks 6 days ago. Offline
Joined: 6 Jul 2011

aha that explains it. I'd rather there was an error message in the simulator saying gifs arent supported on android

Viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.