I've been testing to find best way to optimise png file sizes. 520kb to 254kb.

StormyStudioStormyStudio United KingdomMember Posts: 3,989
edited November -1 in Working with GS (Mac)
I thought I'd share my results after a lunchtime spent reducing the file size of one of my full screen images for my point and click horror game.

The image has lots of varied gradients, rust and noise. With no transparency.

I wanted to reduce the file size as much as possible without changing the quality of the image (too) much.

Previosuly I'd done a quick 'Save for web' out of photoshop,
Chosen 8 bit and reduced the colours to 128.
This achieved a file size of 520 kb.

I've now managed to keep the image quality pretty much the same but reduce the file size to 254kb.

How I did this:

In photoshop, use save for web,

Choose 8 bit.

In the box below PNG-8, where you can choose perceptual,selective etc...I chose 'Mac OS' (this seemed to be the key to a big file size reduction).

Colors: set to Auto (if it does not do this by itself, click on the number in the box and write 'Auto'.)

Dither - set to 'Diffusion' (cycling through them and see what works best for your image.

Then save the image.

Then load up ImageOptim (free to download)
http://imageoptim.pornel.net/

Dropped my image in there and it shaved off another 6.6% of the file size.

And taa daaa!

254 Kb.

Admittedly its not quite as nice looking as a full 24 bit image, but as I've got six of these images in one scene, the more memory I can save the better.

I hope it helps (and thanks to Quantum Sheep for the introduction to Imageoptim)

Comments

  • CoIinCoIin Member Posts: 197
    What size was the original 24 bit png? There will be many cases where the 24 bit one will be a smaller file size than a 16 or 8 bit dithered one would be.

    Also, that only affects file size, the amount of memory needed isn't affected by the size of the file. It can be affected by the bit depth, so being 8 bit might well have helped in RAM usage.

    I think that Joe uses 16 bit, that's probably enough of a saving, without giving up too much quality.
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    24 bit ones were around 650 kb...

    The images actually work fine on my phone when I test the scene, but I just want to get the project size down a bit and try and help loading times.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Wherever I could, I saved my images in the PNG-8 format under Save for Web... in Photoshop. Which creates a 256 color palette for the image. If it doesn't look too awful, you can also lower that number to get it even smaller.

    PNG-8 also allows you to make one single color transparent. I use that whenever possible.

    If the image needed full transparency, I saved it out as PNG-24.

    I then ran all of my images through ImageOptim.

    Like Colin says, this only lowers the overall file size, not the RAM needed to display the images.

    Lowering the file size helps your sanity as well. It of course makes it much quicker to upload/ download/ install on your phone/ etc. Those extra minutes start adding up when you are testing your game heavily.
  • PhoticsPhotics Member Posts: 4,172
    I started messing with that stuff, but I got very disappointed to see that RAM was still being consumed at the same levels.

    This is the test
    ...Create two 1024x1024 PNG files
    ...one is simply two colors
    ...the other is a standard 24-BIT PNG.

    Which takes up less RAM?

    When I tested it, they both used the same amount of RAM. That's when I stopped trying to reduce image quality by reducing the amount of colors.

    I think it's insane that a 733 KB image uses the same amount of RAM as a 4 KB image. I don't know if this is the fault of GameSalad or if it's an Apple hardware / software thing. An image with two colors should not use the same amount of RAM as a 24-bit PNG.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Everything gets loaded into openGL texture memory. Regardless of the initial file format, or file size.
    They are all turned into 24-bit textures, meaning 8 bits per color channel, per pixel.

    24 bits is 3 bytes.

    To find out how much RAM an image will use, simply multiply the number of pixels by 3.

    So a 1024x1024 image will use 3145728 bytes, or about 3.1MB of RAM
Sign In or Register to comment.