Disable PNG compression/optimization in building for iOS

Please, allow to disable PNG compression/optimization in building for iOS. We compress PNGs manually using PngOptimizer (http://psydk.org/PngOptimizer.php) and it compresses images better that utility built into Corona SDK.

Thanks [import]uid: 9058 topic_id: 17549 reply_id: 317549[/import]

I optimise the PNG file in a similar way and the obviously Corona does it as well.

I don’t see a downside of doing both as the image sizes didn’t increase afterwards.

What I did notice though is that external png optimisers can sometimes corrupt an image in some way so then Corona cannot open it and it gives errors. [import]uid: 5354 topic_id: 17549 reply_id: 66713[/import]

@Matthew Pringle
Example, in our game we have about 6.9 Mb of PNG files (PngOptimizer compressed), after build with Corona they take about 7.6 Mb. It’s not a problem for large application, but if you want to fit 20 Mb limit, you have to save every Mb.
Corona for Windows doesn’t compress PNGs, so I just want to be able to disable Corona’s PNG compression for Mac OS (iOS).
Concerning corruption - yes, it occurs, but I may not include images that can’t be opened by Corona or fix image with other graphics tool. [import]uid: 9058 topic_id: 17549 reply_id: 66746[/import]

If I recall correctly, iOS is funny and it actually strips header information of the PNG as a device optimization. This renders the final PNG as unreadable by anything else using a standard PNG viewer including Mac. But I believe this is actually a requirement for iOS, otherwise iOS can’t read the PNG.

[import]uid: 7563 topic_id: 17549 reply_id: 66762[/import]

@ewing
I understand. Thank you for answer.

P.S. Found this interesting article
http://iphonedevelopment.blogspot.com/2008/10/iphone-optimized-pngs.html [import]uid: 9058 topic_id: 17549 reply_id: 66765[/import]

“I don’t see a downside of doing both as the image sizes didn’t increase afterwards.”

Actually there is a downside to this. I’m using PNGGauntlet (windows alternative to “PngOptimizer”) to optimize my PNG files.

On windows, running my code in the simulator, there are no problems at all. However on OSX, with the same exact files, any of the PNG images I display using display.newImage don’t load properly, and just show up as a solid color (white on build #591, or neon green on later builds like #657).

The odd thing is that the spritesheets didn’t seem to have this issue. So it’s either an issue with display.newImage, or an issue with optimized PNGs that don’t have transparency. On OSX only.

Once I used the non-optimized PNGs, the images loaded as expected. Joshua Quick mentioned in this thread that Windows doesn’t re-process PNGs so that may be one of the reasons it’s only an issue on OSX.

Please note though, that this problem can be seen just by running the code in the simulator, without actually building for any device. And it only happens on OSX, not Windows.

Update: I filled out a bug report for this, bug #3111 (logged as case #9576) [import]uid: 49447 topic_id: 17549 reply_id: 67121[/import]

+1

Some title of our ebooks contains 500+ png files. Even we change only one line of lua code, we need to copy/compress the whole bunch of images again before throw it to the device test. It’s quite inefficient. [import]uid: 38415 topic_id: 17549 reply_id: 67656[/import]

This won’t necessarily solve your problem, but for the Xcode Simulator, we just pushed in a change so the Xcode Simulator target won’t call Apple’s copypng tool. If you can use the Xcode Simulator, you might notice a speed up.
[import]uid: 7563 topic_id: 17549 reply_id: 68508[/import]