Multithreaded TIFF to PNG conversion

2

2

I'm working with images of scanned books, so hundreds of high resolution pictures. I'm doing conversion work with Photoshop Elements - I can quickly save them to uncompressed TIFF, but converting to compressed PNG using a single thread takes ages.

Do you know a software, ideally simple and free, that would batch convert those TIFFs to PNG in a multi-threaded manner (4 to 8 simultaneous files) to take advantage of those cores and cut converting times? I'm not too worried in slight variations in final size.

mtone

Posted 2012-04-21T19:01:47.157

Reputation: 11 230

Answers

4

If you're converting a large number of files, you could use GNU parallel in combination with imagemagick to perform multiple jobs simultaneously.

parallel -j 8 convert {} {.}.png ::: *.tiff

...will convert every img.tiff in a directory to an img.png, performing 8 jobs at a time. If you ditch the -j 8, parallel will default to one job per CPU core.

To convert recursively, combine find with parallel:

find . -type f -name "*.tiff" | parallel -j 8 convert {} {.}.png

evilsoup

Posted 2012-04-21T19:01:47.157

Reputation: 10 085

2

ImageMagick is an excellent free piece of software that is able to do what you ask via the command line. Here is an excerpt from the multithread information.

Using it is as simple as typing convert image.tif image.png but can be used with all kinds of options enabled to suit your needs. Check the documentation for more info on this.

Henrik Söderlund

Posted 2012-04-21T19:01:47.157

Reputation: 641

Thanks, that may be workable. Is the command-line multithreaded by default or do I need to use an argument switch? – mtone – 2012-11-12T17:11:39.307

multithreaded by default. It will not be doing multiple files at the time, but rather split the tasks within the one file into multiple threads speeding things up. – Henrik Söderlund – 2012-11-12T18:42:22.067

0

Writing (i.e., compressing) a single PNG file as multithreaded is possible, but hairy. An open source implementation is https://github.com/anvio/png-parallel, linked from https://stackoverflow.com/questions/10827247/parallelization-of-png-file-creation-with-c-libpng-and-openmp .

If possible, instead compress multiple PNG's, one per thread, as evilsoup suggests.

Camille Goudeseune

Posted 2012-04-21T19:01:47.157

Reputation: 1 361