Reducing File Size for PNG Images

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
User avatar
ReX
Posts: 1578
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace

Reducing File Size for PNG Images

Post by ReX »

I realize that file size has become much less of an issue in recent years because of larger bandwidth and faster download speeds. Still, one thing that has bothered me about PNG format images is that they tend to have large file sizes. Collectively, they can make files quite large (and, at some point, make the pk3 or wad take longer to load at game start). At any rate, I was poking around and came across an on-line tool named TinyPNG where I was able to reduce PNG image file sizes by around 70% or more.

The free version allows you to compress up to 20 files, with a maximum file size of 5 MB each. At present, the only way I have found to compress more than 20 files is to exit the web-site, re-enter it, and then drop the next 20 images into the tool. The speed with which the compression occurs is fairly high, and the compressed images are virtually indistinguishable from the originals. So I am very satisfied with the process and the results.

[EDIT: I didn't realize that there have been other posts about this topic.]
User avatar
Rachael
Posts: 13717
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Reducing File Size for PNG Images

Post by Rachael »

I really would not use an online utility for it, especially not for Doom resources.

The best utility to use is pngout. Make sure to run it with "/kgrAb"

After that, you can run deflopt (with /k) to further reduce its size by a few more bytes.

Unfortunately, the original site for deflopt has expired. It appears you can get it with PNGGauntlet, though.
User avatar
ReX
Posts: 1578
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace

Re: Reducing File Size for PNG Images

Post by ReX »

Rachael wrote:I really would not use an online utility for it, especially not for Doom resources.
I'm not quite sure what your objection is based on. I just ran it for 83 files and it was reasonably quick and the results were, for all intents and purposes, lossless.
The best utility to use is pngout. Make sure to run it with "/kgrAb"
I will give this utility a try too, thanks.
User avatar
Rachael
Posts: 13717
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Reducing File Size for PNG Images

Post by Rachael »

ReX wrote:
Rachael wrote:I really would not use an online utility for it, especially not for Doom resources.
I'm not quite sure what your objection is based on. I just ran it for 83 files and it was reasonably quick and the results were, for all intents and purposes, lossless.
You'll lose the grAb and alPh chunks - which is vital information for GZDoom resources. grAb is for sprite offsets and alPh holds alpha information.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49130
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Reducing File Size for PNG Images

Post by Graf Zahl »

alPh is obsolete. It was once used for alpha textures in the software renderer, but that has been refactored so that it isn't needed anymore. The hardware renderer never even used it - it was just a crutch to patch over some shortcomings in the texture manager.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia

Re: Reducing File Size for PNG Images

Post by Matt »

Is there any way to edit the grAb chunk without grabPNG or some other program made specifically to deal with it?
User avatar
Rachael
Posts: 13717
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Reducing File Size for PNG Images

Post by Rachael »

Hex editor?

I don't think there's any reason to compress data that small.

That being said, SLADE handles them perfectly, also.
User avatar
ReX
Posts: 1578
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace

Re: Reducing File Size for PNG Images

Post by ReX »

Rachael wrote:You'll lose the grAb and alPh chunks - which is vital information for GZDoom resources. grAb is for sprite offsets .....
Good to know, thanks.
User avatar
Kappes Buur
 
 
Posts: 4141
Joined: Thu Jul 17, 2003 12:19 am
Graphics Processor: nVidia (Legacy GZDoom)
Location: British Columbia, Canada

Re: Reducing File Size for PNG Images

Post by Kappes Buur »

Another vote for Slade3's png optimization
Spoiler:
Spoiler:
Spoiler:
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49130
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Reducing File Size for PNG Images

Post by Graf Zahl »

Rachael wrote:Hex editor?

That may throw off third party PNG tools because the chunk's CRC will no longer match. I know for sure that some tools will not handle this gracefully and start spamming error messages.
User avatar
Rachael
Posts: 13717
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her

Re: Reducing File Size for PNG Images

Post by Rachael »

Oh, I forgot about the CRC. I think when I did it I manually updated the CRC myself.

Return to “Assets (and other stuff)”