corona simulator won't load grayscale images

Hi,

I ran into an issue attempting to load a JPG or PNG file that is grayscale.
local buttonlogo = display.newImage (“square_320x320.jpg”)

When the jpg file is grayscale it shows as a square block of color with no content.

When I converted the file to RGB it loaded correctly.

Took me forever to figure out what I had done wrong because I kept trying to modify my code and did not notice I had set the file as grayscale when I exported it.

Anyway if this is not a bug let me know what I might have done wrong…

Take care,

Mike <><
[import]uid: 10845 topic_id: 4219 reply_id: 304219[/import]

Not really a bug.

Image for iOS support must be 32 bit RGB.

Carlos [import]uid: 24 topic_id: 4219 reply_id: 13147[/import]

Hi there,

Just following up on this issue, and wondering about the thinking behind defining this as “not really a bug”?

Yes, all images are internally handled as 32 bit RGBA, but not supporting the loading of grayscale PNGs and JPGs makes no sense to me.

I mean, iOS own photo viewer obviously supports loading of greyscale PNGs and JPGs, they are just converted to 32 bit RGBA when loaded.

When you control the images used in a game/app, this issue is not a problem because you just make sure that all images are 32 bit RGBA, but if you load a picture from online, a Facebook profile picture being a very good example, then Corona will fail to load simple grayscale JPGs that work everywhere else. For some reason, Facebook does indeed keep some profile pictures as grayscale, perhaps to save a tiny amount of bandwidth.

I really hope you could fix this, and honestly, I have a feeling the fix might be very simple. I mean, whatever JPG loader is being used, I’m sure that one already loads it correctly, it is just that creating a 32 big RGBA surface from it fails for some reason?

I guess that this failed creation call is what causes this output error:

: CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 16 bits/pixel; 1-component color space; kCGImageAlphaPremultipliedFirst; 800 bytes/row.

I am using Coronas easy to use Facebook integration to load a user’s profile picture and this bug is actually a slight show stopper for me. I would gladly help out to fix this somehow.

Thanks for a great product, it really makes rapid development possible!

Cheers,

Trond.
[import]uid: 34372 topic_id: 4219 reply_id: 24502[/import]

Yes, I would agree…wouldn’t this help me make leaner (memory size) apps? [import]uid: 13284 topic_id: 4219 reply_id: 24530[/import]