Closed AlexJacobs1977 closed 4 years ago
Bad idea. PNG is long. Use GraphicsMagick.
Bad idea? I have a TIFF file of 20 KB. With the conversion with GIMP (2.10.18) , the PNG file is 30 KB, which is very reasonable in my eyes. In the past, the conversion with GIMP was desastreus.
PNG is a long encoding time, even on small files.
@AlexJacobs1977, I believe that you can use imagemagick's convert in a very simple command line instead of firing up the GIMP.
Something along the lines of:
for i in *.tif; do convert "$i" "${i%%tif}png"; done
If you need better compressed PNG files after that, then you can add a post processing phase with optipng
(or any one of the many lossless optimizers of PNG).
One thing, though: it is very hard to have PNGs (with black and white content) that are as small as CCITT and/or JBIG2 files.
@rbrito
Something along the lines of:
for i in *.tif; do convert "$i" "${i%%tif}png"; done
On a multi-core system it would be much faster to use magick or any other heavy computational application along with xargs
(or parallel
):
find . -maxdepth 1 -type f -name '*.tif' -print0 | xargs -0 -P`nproc` -l -i bash -c 'src="{}"; dest="${src%.*}.png"; magick convert "$src" "$dest"'
For Windows there is a nice analogue of xargs
called ppx2
(binaries for x32 and x64)
dir /b /a:-d *.tif | ppx2 -P %NUMBER_OF_PROCESSORS% -L 1 -I {} cmd /c "echo off & for /f "tokens=*" %a in ("{}") do magick convert "%~a" "%~na.png""
@AlexJacobs1977, PNG uses Deflate algorithm to compress any images and that's not effective for black-and-white output. TIFF is a much more flexible format that supports multiple encoding algorithms for both color and B&W, including Deflate. For example, in STA, you can set Color Compression to Deflate, and you will get the same compression rate as PNG for non-B&W images.
Thank you for scantailor advanced, it's a really great program which I use very much. In my epubs, I use png files. After scantailor, I use GIMP to convert the tiff into png. The file is slightly larger, but doesn't increase that much. I would really love png as output in scantailor advanced.