PNG optimization

Previous topic - Next topic

Kuron

Quote from: Moru on 2010-Apr-19here in the forests of northern Sweden :-)
Such a lovely country.  Many years ago I spent a little bit of time at Muskö naval base getting something I can't talk about repaired while we were doing something I can't talk about and had an incident I can't talk about that damaged the first thing I can't talk about.  Lovely and very hospitable folks at Muskö.  Muskö was the most impressive non USA underground military facility I have ever seen.


Moru

The top pictures are gone, it's an old post but search on google, you find lots of movies on youtube too.

Scott_AW

I like PNGs because of their loss-less compression, and they help in reducing overall program size on disk, but is there an improvement in the time it takes for loading graphics if you use uncompressed BMP files?
Current Project, Orbital Contract Defense
http://gamejolt.com/games/adventure/code-name-ocd/9887/

BlackShadow now open source/resource(requires duke3d)
http://gamejolt.com/games/adventure/black-shadow-3d/9885/

Kuron

Quote from: Scott_AW on 2010-Apr-22is there an improvement in the time it takes for loading graphics if you use uncompressed BMP files?
Yes, but how much faster can really vary.

Scott_AW

Well I can check it out later tonight and see.

The tech demo I have below(PC & OSX) uses 27 1024x600 24bit png images, it eats a bunch of loading time.  So I can try converting them to BMPs and see if there is any improvement from it.

http://www.glbasic.com/forum/index.php?topic=4413.0
Current Project, Orbital Contract Defense
http://gamejolt.com/games/adventure/code-name-ocd/9887/

BlackShadow now open source/resource(requires duke3d)
http://gamejolt.com/games/adventure/black-shadow-3d/9885/

Scott_AW

Got a chance to check it out...

So with my demo using 37 1024x600 images:


BMP(24bit)
   Total Size = 46mb
   Zipped Size = 3.6mb
   Game Loadtime = 4 seconds
PNG(24bit)
  Total Size = 5mb
  Zipped Size = about the same
  Game Loadtime = 4 seconds

I guess the next thing to check would it be beneficial to degrade the color capacity to 8bit colors for further performance.  At least done to the tile layers but not the glow layer(would kill the gradients).  Anyone know if using 8bit images has any effect when loaded into the game than higher bit rates?
Current Project, Orbital Contract Defense
http://gamejolt.com/games/adventure/code-name-ocd/9887/

BlackShadow now open source/resource(requires duke3d)
http://gamejolt.com/games/adventure/black-shadow-3d/9885/

Kuron

QuoteI guess the next thing to check would it be beneficial to degrade the color capacity to 8bit colors for further performance.
In general, loading an 8 bit BMP is slower than loading a 24 bit BMP.  But, it may not be much of an issue anymore.

In the old days, you would never use JPG or PNGs in a game or app.  Loading speed was slow because of decompression time.  Now with modern processors and multicores, it may give you almost no penalty due to fast modern CPUs, but that's an entirely different thing.  Compressed images should never give you better performance than a 24 bit BMP, but it can give you equal performance.

8 bit BMPs used to always be slower and something to be avoided because the palette has to be read before the image can be displayed.  24 bit BMPs don't have a palette, and load very fast.  However with modern processors and operating systems, the palette handling could easily be pushed into its own thread or even another core to give a speed boost.  However, 8 bit images were smaller and were widely used in gaming for that reason alone even after 24 bit hardware became mainstream.  Distribution size was/is always important (which is why people will still use 24 bit BMPs over JPG or PNG as 24 bit BMPs compress smaller for distribution).

Scott_AW

I didn't take into consideration the palette part, but that does make sense.

Also an 8bit PNG can be larger than 24bit PNG, most likely due to the palette data.

Previously when working with 8bit graphics I was using GIF files, since they are pretty nice for limited colors and produce smaller files in that regard compared to PNGs.  That and animation capabilities.  Both can have transparent backgrounds.  However it seems that GIF support is dying out.

I recall in the past GIF was kind of a dead fish due to some very strict and stupid license it, preventing it from really moving beyond a simple web graphic.  That expired many years ago, but too late really.
Current Project, Orbital Contract Defense
http://gamejolt.com/games/adventure/code-name-ocd/9887/

BlackShadow now open source/resource(requires duke3d)
http://gamejolt.com/games/adventure/black-shadow-3d/9885/

spicypixel

I wrote a GUI wrapper for OptiPNG. Simply drop your PNG's into the input directory and run the gui. Hope some of you find it useful.


[attachment deleted by admin]
http://www.spicypixel.net | http://www.facebook.com/SpicyPixel.NET

Comps Owned - ZX.81, ZX.48K, ZX.128K+2, Vic20, C64, Atari-ST, A500.600.1200, PC, Apple Mini-Mac.