Reducing PNG size

glyniusglynius Member Posts: 231
edited September 2012 in Working with GS (Mac)
Hi everybody...
i discovered this service
http://tinypng.org/

seems that works fine for reducing png file sizes.
Hope it helps.

Comments

  • MantoManto Member Posts: 796
    Looking good. I got 60% smaller files and didn't notice any difference in quality. Thanks for sharing!
  • glyniusglynius Member Posts: 231
    Well, i am using tinypng for some time now, and it is really amazing. If you want even smaller files, one way is to add a posterize effect on photoshop, and adjust posterize levels according to your needs ( it is a preview there to see how much levels you should keep, to have your gradients better), after this, save for web as png and then convert this png to even smaller with tinypng. You will end to 60-90% smaller files.
  • SocksSocks London, UK.Member Posts: 12,822
    All these file size reducing algorithms, filters, websites, services, techniques, applications (etc) work really well for making your app size smaller - but once loaded into the RAM of your target device all your data wrangling is lost as your image is converted back to 24 bit colour space.
  • glyniusglynius Member Posts: 231
    @Socks i don't get it, i will tell you an example, i had some background images of 1,5 MB, when i tried to play the game on device, i had a lot of problems, everything was slow, when i reduced the background images to 300kb everything worked just fine on device. So? you mean that it doesn't matter (except the downloading time) if i reduce my images? Sorry if i get something wrong.
  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2013
    @Socks i don't get it, i will tell you an example, i had some background images of 1,5 MB, when i tried to play the game on device, i had a lot of problems, everything was slow, when i reduced the background images to 300kb everything worked just fine on device. So? you mean that it doesn't matter (except the downloading time) if i reduce my images? Sorry if i get something wrong.



    Example (arbitrary made up values for illustrative purposes):

    PNG file (on your computer) 5MB
    PNG file (as part of your GS app) 5MB
    PNG file (loaded into memory on your iDevice) 5MB

    Optimized/compressed/colour depth reduced (etc) version:
    PNG file (on your computer) 1MB
    PNG file (as part of your GS app) 1MB
    PNG file (loaded into memory on your iDevice) 5MB


    Hope that makes sense!

  • glyniusglynius Member Posts: 231
    It sounds clear enough, so, optimizing your images has only to do with the project-app size overall and not with faster loading while playing?
  • ericzingelerericzingeler Member Posts: 334
    Yep, image optimization is good for app size only. Image dimensions effects performance.
  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2013
    It sounds clear enough, so, optimizing your images has only to do with the project-app size overall and not with faster loading while playing?
    Well, with optimised files your app will be smaller - and often with carefully applied optimisations there will be no quality loss (at least no perceivable quality loss).

    The files once opened on the device will return to something like the same (memory) size as the original un-optimized images.

    As for loading speeds, I can't really comment - if someone who knows about these things could chime in that would be cool . . . but here are my suspicions, with an optimised image there may (a guess) be a conversion stage where the device has to map the image to a 24bit colour space, so I'd expect optimised images to be slower when it comes to loading, but this process could be trivial and the times involved fractional, so it may make very little difference in the real world.

    There's some guess work here so If I get the chance I might test this idea.
  • gamesfuagamesfua Member Posts: 723
    Sometimes i listen in on these forums and am completely awe struck over the knowledge. I'm sorry but how in the world do you guys know this much technical stuff?! Amazing!
    I don't understand a word of it- but its impressive. Very inspiring.
    I guess i'll just stick to the fart jokes while you guys somehow talk about the infrastructure of optimized molecular nano bots.
    Very impressed and very useful information in here!
  • glyniusglynius Member Posts: 231
    So,an example...let's say that i have a backround image, it is 5MB, it is better to cut
    this background image, in several boxes, and save individual images and the compose them in gamesalad, instead of using this background image as a single image?
  • SocksSocks London, UK.Member Posts: 12,822
    So,an example...let's say that i have a backround image, it is 5MB, it is better to cut
    this background image, in several boxes, and save individual images and the compose them in gamesalad, instead of using this background image as a single image?
    If your original B/G image follows the memory size rule (sized to 64, 128, 256, 1024 . . . etc) then chopping it into smaller pieces offers no advantage.

    A 1024 x 1024 image occupies the same amount of memory as four 512 x 512 images or sixteen 256 x 256 images.
  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2013
    Actual numbers from an iPad:


    2048 x 2048 PNG:

    File size on hard drive: 13.3 MB
    File size inside GameSalad: 12.5MB
    File on device: images 8MB / other 16.9MB / Total 25.7MB


    2048 x 2048 PNG [optimized to death, reduced to 2 colours]

    File size on hard drive: 354 kb
    File size inside GameSalad: 687 kb
    File on device: images 8MB / other 17MB / Total 25.9MB


    So, while optimizing your PNGs will make your app size smaller, it won't have any effect on performance - or how much RAM the image occupies.
  • glyniusglynius Member Posts: 231
    Thanks @Socks, clear enough..
  • gamesfuagamesfua Member Posts: 723
    @socks i'm not sure this is the right place to ask, but why does it do that? Why does an image that is compressed revert back to its original size? I'm not a technical person so i'm confused. Does GS or whatever essentially unpackage the file or something? I'm assuming compressing an image is like zipping it- where the file is simply squeezed down, but its still the same amount of clothes in a suitcase?
    Again probably not the place to ask but you seem very knowledgeable and i'm curious as hell.
    Thanks my friend
  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2013
    Why does an image that is compressed revert back to its original size?
    When loaded onto the target device a 2048 x 2048 pixel image occupies a 2048 x 2048 pixel chunk of memory regardless of the contents of that image, so nothing is really reverting back to anything.
    Does GS or whatever essentially unpackage the file or something?
    It's nothing to do with GS, it's the way the target device handles image data.
    I'm assuming compressing an image is like zipping it- where the file is simply squeezed down, but its still the same amount of clothes in a suitcase?
    Like the analogy ! :))

    There are various types of compression, the only thing you really need to know is whether they are lossy or lossless.

    Zipping a file is lossless (you can retrieve the data intact and unchanged by unzipping it)
    A Jpeg is - famously - lossy, once Jpeg'd there's no going back, data is gone forever.

    Generally speaking compressing an image is not like zipping as one is lossless (zipping) and the other is lossy (image compression - although there are lossless image compression schemes around like LZW).

  • gamesfuagamesfua Member Posts: 723
    Thanks @socks! Wow never knew that stuff. Wish i had. I downgraded some of my graphics because i thought it would hinder performance. Ah well. Thanks again!
  • SocksSocks London, UK.Member Posts: 12,822
    I downgraded some of my graphics because i thought it would hinder performance.
    Sometimes it's worth 'optimizing' ('downgrading' sounds too negative ! 8-X :) ) your graphics simply to have a faster loading game, if gameplay is snappy but loading time between each scene takes 18 seconds the overall impression will be of a sluggish game.
  • debchdebch Member Posts: 4
    http://compresspng.com
    Another tool, I think it's even better.
  • MayhemmmartyMayhemmmarty Member, PRO Posts: 39
    Why I didn't find this sooner? tinypng.org worked wonders on png sizes. Reduce project size 40%!
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    I'm assuming compressing an image is like zipping it- where the file is simply squeezed down, but its still the same amount of clothes in a suitcase?
    Like the analogy ! :))
    :P

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @gyroscope

    I think we're missing out on a golden opportunity...

    "Don't know how to fold a comforter? There's an app for that!"

    Someone beat me to it: https://itunes.apple.com/us/app/how-to-fold-clothes-lite/id582647966?mt=8.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Member Posts: 12,822
    edited January 2014
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    @gyroscope

    I think we're missing out on a golden opportunity...

    "Don't know how to fold a comforter? There's an app for that!"

    Someone beat me to it: https://itunes.apple.com/us/app/how-to-fold-clothes-lite/id582647966?mt=8.
    Wow, there IS an app for that! Cheers, @tatiang. :-)
    @gyroscope

    Well I never! :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.