View Full Version : PNG encoders
STaRGaZeR
26th January 2014, 21:36
I'm completely lost as to where to put this, since there isn't a image encoding section. Mods, move this if you think there is a better place.
I'm looking for information about PNG encoders. Google returns a lot of useless articles about programs that do all kinds of nasty stuff to the images, so I'm really lost. I donwloaded one that supports bulk conversion, and the resulting PNGs were bigger than what Paint produces, so yeah. The goal here is to convert huge ass BMP images to lossless PNG, as small as possible. Bulk encoding is a plus, because I have a lot of them. Encoding time is not a factor to even consider, I'm just looking for the best compression.
Thanks for any info!
raffriff42
26th January 2014, 21:52
ImageMagick (http://www.imagemagick.org/script/convert.php) (command-line style)
IrfanView (http://www.bleepingcomputer.com/forums/t/50519/simple-batch-conversion-using-irfanview/) (GUI style)
EDIT what have you tried already? What are these "programs that do all kinds of nasty stuff to the images?"
What kind of images are you working on? If you can clean them up prior to saving, the files will be much smaller.
nhakobian
26th January 2014, 22:43
You may want to look at pngcrush and pngout. Once you have your bmp files in png format (using something like ImageMagick with the appropriate options to make it lossless), these programs will optimize the compression and (with the right command line options) remove metadata you may not need. I know website designers use it to reduce the size of images to make loading a website faster (but it has tons of other uses too). The wikipedia page on pngcrush does go into some depth as to how it works.
Reino
27th January 2014, 11:20
...I'm just looking for the best compression.In that case you might wanna give Irfanview's Batch conversion feature a try, converting your images to lossless WebP (https://code.google.com/p/webp/downloads/detail?name=WebpCodecSetup.exe&can=2&q=). Compression takes a lot more time than PNG, but the filesize will also be quite a bit smaller.
SeeMoreDigital
27th January 2014, 21:56
I use VirtualDub to perform this type of task.
Your input source files have to be in numerical order and placed within a single folder.
Cheers
STaRGaZeR
27th January 2014, 23:25
Thanks for the info guys. It seems all of these "optimizers" are really doing the same thing, and with almost the same configurable options. I have been playing with several of them and the one I like the most is OptiPNG. It seems that all the info that you need for encoding and optimizing PNG can be found here: http://optipng.sourceforge.net/pngtech/optipng.html
The main options are:
- zlib compression level: just use the maximum. Minimal impact on both compression speed and size, except for absurdly low values nobody cares about.
- zlib memory levels: just use the maximum. Minimal impact on both compression speed and size, except for absurdly low values nobody cares about.
- zlib compression strategies: explained in the link above. Critical setting for compression speed.
- zlib window size: just use the maximum. Minimal impact on both compression speed and size, except for absurdly low values nobody cares about.
- PNG delta filters: explained in the link above. Critical setting for compression efficiency.
The two main settings are the delta filters and the compression strategy. Delta filters causes a massive improvement in size. Something like:
- Original BMP: 64 MB
- PNG without filters: 38 MB. This is what Paint/MPC-HC produce.
- PNG with filter 5: 18 MB. This is even smaller than the original image 7zip'ed :eek:
It seems no filters are recommended when images are <8 bits, so that doesn't apply here. Then there is the compression strategy parameter, which is also explained in the link above. The catch is that when you use filter 5, the difference between strategy 0-1 and 2 is small in size but massive in encoding time.
- Original BMP: 64 MB
- PNG filter 5 + strategy 1: 80 seconds, 18.8 MB
- PNG filter 5 + strategy 2: 5 seconds, 19.3 MB
What all these optimizers do is try several combinations of these parameters, picking the best one. After doing some tests myself, filter 5 + strategy 2 seems to be the best speed/compression combination, so that's what I'll use for general PNG from now on.
Now I need to make myself a batch encoding script :D
Sven Bent
28th January 2014, 07:07
might wanna try out pngwofl with zopli compressiion
and always use deflopt as the optimizng stage for png files
here is my simple optimizing batch
@ECHO OFF
pngwolf.exe --in=%1 --out=%1 --zopfli-iterations=50
for %%i in (6,0,1,2,3,4,5) do pngout %1 /f%%i
for %%i in (0,64,96,128,192,384,512,768,1024,1536,2048,4096,8192) do pngout %1 /b%%i
REM for /l %%i in (1,1,99) do pngout %1 /r
Deflopt %1
you ca do an entire folder by using the command
For %f in (*.png) do batcfile.bat %f
also by my experience dont use pngcrush. it just doest not do a good enough job for the time.
if you want to sav some time readue zopflit iterans bakc dow nto 15
if you want more compression remove "REM" and the beginning of the second last line
STaRGaZeR
31st January 2014, 00:43
Nice, will try pngwolf tomorrow, thanks.
Do you know how to make a batch file that properly handles characters like "â" and asian languages?
foxyshadis
31st January 2014, 00:54
Nice, will try pngwolf tomorrow, thanks.
Do you know how to make a batch file that properly handles characters like "â" and asian languages?
Batch files always do, only the programs need to support unicode.
Make sure to quote the %1 arguments, though.
STaRGaZeR
31st January 2014, 16:22
Batch files always do, only the programs need to support unicode.
Make sure to quote the %1 arguments, though.
This doesn't seem to work for me:
@ECHO OFF
FOR /R %%i IN (*.png) DO (
"D:\OptiPNG\optipng.exe" "%%i" -preserve -clobber -i 0 -zc 9 -zm 9 -zs 1 -zw 32k -f 5
REM DEL "%%i"
)
PAUSE
The error messages are all like:
** Processing: C:\Test\??????.png
Error: Can't open the input file
** Status report
1 file(s) have been processed.
1 error(s) have been encountered.
The batch file was located at C:\Test.
Reino
1st February 2014, 20:57
After doing some tests myself, filter 5 + strategy 2 seems to be the best speed/compression combination, so that's what I'll use for general PNG from now on.I didn't know OptiPNG, so I did some tests. If you want the best compression, I'd use PNGOUT instead, or even better; lossless WebP!
STaRGaZeR
3rd February 2014, 22:57
Pngout is better, but a lot slower. Being single threaded doesn't help either. I have time to burn but I don't feel like doing it for minimal gains.
WebP isn't compatible with most stuff, not an option unfortunately.
ricardo.santos
4th February 2014, 09:26
heres an option for batch conversion: PNGGauntlet
"Combines PNGOUT, OptiPNG, and DeflOpt to create the smallest PNGs"
just tried on my eeepc...slow but with lots of options
http://pnggauntlet.com
hope it helps
rvs75
4th February 2014, 15:45
I use http://nikkhokkho.sourceforge.net/static.php?page=FileOptimizer
It's more a GUI but it "Combines PNGOUT, OptiPNG, and DeflOpt to create the smallest PNGs"
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.