File Size Optimization

Not sure if “File Size Optimization” is the right title, but it think it will do. I have been very impressed with

Corona’s API and it has served me extremely well. It addressed a great variety of things, but the one thing I noticed that it did not, was Optimizing the memory of the app.

Basically what I mean is that my app is around 60 mbs and I would like it to become 20 so that it can be downloaded via 3G.

I am wondering…

What is the smallest image file extension… .png, ,jpg, etc.

What is the smallest sound file extension… .mp3, .wav, etc.

Is there anything that I can do in my code to make my app less memory?

–Thank You in advance for any help–

-Kurt

[import]uid: 86879 topic_id: 18242 reply_id: 318242[/import]

http://forum.xda-developers.com/showthread.php?t=882742

here is a thread about it xda forum you can compress files with apktools;)
[import]uid: 86417 topic_id: 18242 reply_id: 69809[/import]

Clear answer is it depends… :slight_smile: Of course if we talk about sound wav format is biggest because lack of any compression and mp3 (44kHz, 128kbs) should be about 10 times smaller.

In case of graphics files there is no clear answer. JPEG format is quite old right now and lose quite a bit information and quality when you put compression scale below 82% but in case of large graphic file (for example 512px W 512px H) should be smaller when optimized PNG file. For smaller files PNG file should give you much better result.

Other thing you should know is when you load your file from device “disk memeory” to RAM memory every graphic file is decommpressed. In RAM memory is preserved as 32 bits information for every pixel so even if you have 200px x 200px PNG file with 30kb size on disk it can occupy 2MB RAM memory.

Conclusion is don’t put file size over images quality in my opinion. [import]uid: 12704 topic_id: 18242 reply_id: 69825[/import]

How do I compress the files? [import]uid: 86879 topic_id: 18242 reply_id: 69897[/import]

you need to unpack the apk and pack the png files and pack apk and sign it again.

[import]uid: 86417 topic_id: 18242 reply_id: 69899[/import]

I am creating for iOS [import]uid: 86879 topic_id: 18242 reply_id: 69922[/import]

oh you could say that next time;( [import]uid: 86417 topic_id: 18242 reply_id: 69927[/import]

Each format (regardless of media type) has strengths and weaknesses that must be considered. Many times, “size” is one of the weaknesses to think about.

With that said, typically I do the following to keep sizes down:

  1. Use only mp3s
  2. Use .pngs
  3. Use sprite sheets rather than separate images when appropriate (for instance, 1 larger png rather than 20 smaller ones)
  4. Separate image components and put them together programmatically rather than making multiple images for each combination.
  5. Use text functions and font sets rather than images for words/numbers.

In regards to code, Ansca is relatively good at keeping the size of the code to a minimum, so there’s not much you can do there. However, if you’re using OpenFeint, removing it will probably get you back another mb or 2. [import]uid: 36054 topic_id: 18242 reply_id: 69930[/import]

@Swello Applications if you badly need small app size use mp3 insted of wav files and compress your graphics file. Most graphics software have optimization JPEG option and “save for web” export.
This will give you smaller graphisc file size but make them look ugly on retina display. [import]uid: 12704 topic_id: 18242 reply_id: 69931[/import]

For i Devices your best bet is

.wav for sound effects
.m4a for music

.png for images [import]uid: 84637 topic_id: 18242 reply_id: 69948[/import]