Hello all, I think your software (pngout) is very useful! But in some cases, I can compress my PNG pictures more with softwares like optipng, advpng and DeflOpt. According of this, I've type a small batch file:
optipng.exe -i0 -zc1-9 -zm1-9 -zs0-3 -f0-5 -q *.png for %%i in (*.png) do pngout.exe /q %%i for %%i in (*.png) do pngout.exe /c0 /q %%i for %%i in (*.png) do pngout.exe /c2 /q %%i for %%i in (*.png) do pngout.exe /f1 /q %%i for %%i in (*.png) do pngout.exe /f2 /q %%i for %%i in (*.png) do pngout.exe /f3 /q %%i for %%i in (*.png) do pngout.exe /f4 /q %%i advpng.exe -z -4 -q *.png DeflOpt.exe /s /r *
And I want to know if is it possible to make this better. For example, is it useful to do that after:
for %%i in (*.png) do pngout.exe /d0 %%i for %%i in (*.png) do pngout.exe /d1 %%i for %%i in (*.png) do pngout.exe /d2%%i for %%i in (*.png) do pngout.exe /d4 %%i for %%i in (*.png) do pngout.exe /d8 %%i
? Does "for %%i in (*.png) do pngout.exe %%i" tries to find the smallest color bit depth, or must I write all these lines? Another question: Does pngout try to find the smallest color bit depth for a picture or does it select the which one which make the picture size the smallest (because some pictures are compress better with a 16 bit depth than 8 ).
Should I change the order of the program in my batch file? Should I add some kind of other software ?
Sorry for my poor english, and thanks a lot if you help me!
Edited by Sined at
Awesoken at
Re: PNG Optimization
* You don't need /d0 if you're already doing /d1,/d2,/d4,/d8. The bitdepth option /d# only needs to be used in the /c0 and /c3 modes. PNGOUT will use the smallest color bit depth if it thinks the file was not previously compressed with PNGOUT. Otherwise, it re-uses the bitdepth from the source. I have an imperfect way of detecting whether the file was compressed previously with PNGOUT. PNGOUT does not support 16-bit depth. I think you mean 4 bit depth (16 colors).
* You can often save a lot of bytes by running exhaustive trials with: /b# or /n#, and /r.
* You can shorten your scripts by using a trick with the 'for' syntax. See the hints in this thread: http://jonof.edgenetwork.org/forum/index.php?topic=846.0
Edited by Awesoken at
Sined at
Thanks very much for that fast answer! I just have something to say about: Awesoken said at
* I find advdef to be much more useful than advpng.
I've do ~75 tests with PNG pictures and advpng always compress more than advdef.
Awesoken at
I usually run the image through optipng or pngout (with various options) before using advdef. When you've found good options, advdef is just as good as advpng - and always works. Advpng doesn't work on many file types, including /c0 and /c4.
counting_pine at
optipng.exe -i0 -zc1-9 -zm1-9 -zs0-3 -f0-5 -q *.png for %%i in (*.png) do pngout.exe /q %%i for %%i in (*.png) do pngout.exe /c0 /q %%i for %%i in (*.png) do pngout.exe /c2 /q %%i for %%i in (*.png) do pngout.exe /f1 /q %%i for %%i in (*.png) do pngout.exe /f2 /q %%i for %%i in (*.png) do pngout.exe /f3 /q %%i for %%i in (*.png) do pngout.exe /f4 /q %%i advpng.exe -z -4 -q *.png DeflOpt.exe /s /r *
Don't forget, you can add in this line too:
for %%i in (*.png) do pngout.exe /f5 /q %%i
Filter type 5 often tends to be better than types 1-4, so it's worth including.
I also recommend replacing advdef with advpng. Advpng always compresses the png with filter type 0 (equivalent to /f0 in pngout). But if filter type 0 is the best filter type, then optipng or pngout will have already have changed the filter type to 0, and advdef and advpng should then compress the same. But if another filter type is better, then Advdef will use the best filter type from the runs before.
Sined at
I've changed the PNGu compression batch file from A.C.Dent 2006. That's now faster and the compression is better! If you want to try it:
@echo off
if not .%1==. goto i echo. echo Optimizes PNG files. echo. echo You can drag-and-drop any number of PNG files onto this file echo to batch optimize them all. The title bar of the command window echo will display progress information. pause
:i set dir="F:\png\"
cd %dir% set dir=%dir:"=% %dir:~0,2% for %%i in (%*) do set /a pngs+=1
:s set /a png+=1
set z0=%~z1 title PNG %png% of %pngs% (1/17) echo %png% of %pngs% PNG picture(s) echo %1: PNGOUT(1/17): %~z1bytes for /L %%j in (0,16,128,160,32,512,768,256,2048) do for /L %%k in (0,1,5) do pngout.exe /q /b%%j /f%%k /d0 "%1" title PNG %png% of %pngs% (2/17) echo %1: PNGOUT(2/17): %~z1bytes for /L %%k in (0,1,5) do pngout.exe /q /f%%k /d8 "%1" title PNG %png% of %pngs% (3/17) echo %1: PNGOUT(3/17): %~z1bytes for /L %%k in (0,1,5) do pngout.exe /q /f%%k /c2 "%1" title PNG %png% of %pngs% (4/17) echo %1: PNGOUT(4/17): %~z1bytes for /L %%k in (0,1,5) do pngout.exe /q /f%%k /c4 "%1" title PNG %png% of %pngs% (5/17) echo %1: optipng(5/17): %~z1bytes for %%j in (32k,16k,8k,4k,2k,1k,512) do optipng.exe -q -i0 -zw%%j -zc1-9 -zm1-9 -zs0-3 -f0-5 -fix "%1" title PNG %png% of %pngs% (6/17) echo %1: advpng(6/17): %~z1bytes for /L %%j in (1,1,4) do advpng.exe -q -z -%%j "%1" title PNG %png% of %pngs% (7/17) echo %1: advdef(7/17): %~z1bytes for /L %%j in (1,1,4) do advdef.exe -q -z -%%j "%1" title PNG %png% of %pngs% (8/17) echo %1: DeflOpt(8/17): %~z1bytes DeflOpt.exe /s "%1" title PNG %png% of %pngs% (9/17) echo %1: OptiPNG(9/17) optipng.exe -q -i0 -nz -fix -out "%1.png" "%1" title PNG %png% of %pngs% (10/17) echo %1: PNGOUT(10/17) for /L %%j in (0,16,128,160,32,512,768,256,2048) do for /L %%k in (0,1,5) do pngout.exe /q /b%%j /f%%k /d0 "%1.png" title PNG %png% of %pngs% (11/17) echo %1: PNGOUT(11/17) for /L %%k in (0,1,5) do pngout.exe /q /f%%k /d8 "%1.png" title PNG %png% of %pngs% (12/17) echo %1: PNGOUT(12/17) for /L %%k in (0,1,5) do pngout.exe /q /f%%k /c2 "%1.png" title PNG %png% of %pngs% (13/17) echo %1: PNGOUT(13/17) for /L %%k in (0,1,5) do pngout.exe /q /f%%k /c6 "%1.png" title PNG %png% of %pngs% (14/17) echo %1: OptiPNG(14/17) for %%j in (32k,16k,8k,4k,2k,1k,512) do optipng.exe -q -nb -nc -zw%%j -zc1-9 -zm1-9 -zs0-3 -f0-5 "%1.png" title PNG %png% of %pngs% (15/17) echo %1: advpng(15/17) for /L %%j in (1,1,4) do advpng.exe -q -z -%%j "%1.png" title PNG %png% of %pngs% (16/17) echo %1: advdef(16/17) for /L %%j in (1,1,4) do advdef.exe -q -z -%%j "%1.png" title PNG %png% of %pngs% (17/17) echo %1: DeflOpt(17/17) DeflOpt.exe /s "%1.png"
set /a zs=%z0%-%~z1 echo %1: %zs% byte(s) saved! echo.
Thanks for taking the time to tweak my original script. However, it might be best to continue this thread with the discussion here: http://jonof.edgenetwork.org/forum/index.php?topic=846.0
Later today I hope to release a beta of the updated script I've been working on recently. I would encourage you to check it out / hack away at it. Cheers.