Friendly request: please optimze your PNG images

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
PooshhMao
Posts: 135
Joined: Sun Oct 06, 2013 2:09 am

Friendly request: please optimze your PNG images

Post by PooshhMao »

Hi,

I've been taking some mods apart to see what makes them tick.
I've noticed that pretty much all of them come with unoptimized PNG images (I'm going to refrain naming names at the moment).

In most cases, it doesn't make a large difference, but in some, it does - sometimes I can reduce the image to less than half their original file size.

There's a number of ways to do this. If you're on Linux, pngcrush is the most straightforward. If you're on anything resembling Debian, it should be in the repositories. Windows users can choose between crushpng or tinypng AFAIK.

There's a bunch of reasons why you'd want to do this. Your mod will be smaller, it will load faster, and it'll use less memory.

Thank you for considering!
Accensus
Posts: 2383
Joined: Thu Feb 11, 2016 9:59 am

Re: Friendly request: please optimze your PNG images

Post by Accensus »

Converting PNGs to paletted colors in SLADE or changing them to Index in Photoshop works too, but for the most part makes the quality crap. Some soft gradient spots start to look at lot less pleasant to the eye.
PooshhMao
Posts: 135
Joined: Sun Oct 06, 2013 2:09 am

Re: Friendly request: please optimze your PNG images

Post by PooshhMao »

That's something else altogether. Reducing the color palette obviously makes the image smaller too, but if the image contains more than 255 unique colors (+ transparency), and you change it to have indexed color, then obviously you're going to see reduced color depth.

But that's not what crushpng does. It retains the original color depth, it just saves the image in an optimized fashion. There's no perceivable difference at all, the end result is identical.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49184
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Friendly request: please optimze your PNG images

Post by Graf Zahl »

PooshhMao wrote:and it'll use less memory.
No, it won't. PNGs are always decompressed before being used. It doesn't even make a difference if the source is a true color or paletted image - internally all PNGs will be turned into a32 bit flat image for hardware rendering and an 8 bit flat image for software rendering.
User avatar
DaMan
Posts: 727
Joined: Fri Jan 01, 2010 7:14 am

Re: Friendly request: please optimze your PNG images

Post by DaMan »

Plugging File Optimizer. For extra convenience put in the send to menu.
User avatar
The Zombie Killer
Posts: 1528
Joined: Thu Jul 14, 2011 12:06 am
Location: Gold Coast, Queensland, Australia

Re: Friendly request: please optimze your PNG images

Post by The Zombie Killer »

DaMan wrote:Plugging File Optimizer. For extra convenience put in the send to menu.
unless that tool lets you tell it not to strip specific custom chunks (specifically, grAb), then it's useless for ZDoom modding (I haven't looked at it, so I don't know if it can do that)
User avatar
Dark-Assassin
Posts: 742
Joined: Thu Mar 19, 2009 3:40 am
Location: South Australia

Re: Friendly request: please optimze your PNG images

Post by Dark-Assassin »

Still helpful to those who have really crappy download speeds.
Same goes for music and other audio files.

I personally am turned off from downloading large mods because of this shitty Australianet
Gez
 
 
Posts: 17934
Joined: Fri Jul 06, 2007 3:22 pm

Re: Friendly request: please optimze your PNG images

Post by Gez »

That's why I made it so that you can call pngout, pngcrush, and deflopt from within SLADE 3 to optimize PNGs though without losing important lumps (like grAb, which contains the offset information for sprites) that these tools don't know should be kept.
PooshhMao
Posts: 135
Joined: Sun Oct 06, 2013 2:09 am

Re: Friendly request: please optimze your PNG images

Post by PooshhMao »

Graf Zahl wrote: No, it won't. PNGs are always decompressed before being used. It doesn't even make a difference if the source is a true color or paletted image - internally all PNGs will be turned into a32 bit flat image for hardware rendering and an 8 bit flat image for software rendering.
Alright. Still, that leaves two good reasons why you'd want to optimize your PNG's.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space

Re: Friendly request: please optimze your PNG images

Post by NeuralStunner »

I made a batch program to run pngcrush on numerous files. With options to keep/strip chunks like tRNS and grAb. (Also works from backup files just in case something goes bad.) That was torturous.

Return to “Editing (Archive)”