Page 1 of 1

Is it possible to output 2 file formats using mogrify

Posted: 2018-09-12T12:54:21-07:00
by B_Gaspar
Hi. I'm using latest version of IM and I'm doing batch commands in .bat file using Windows 10.
My question is if it is possible for command mogrify to process an image and create two different outputs.
Example: input folder with 0001.tif, 0002.tif, 0003.tif...
mogrify -quiet -fuzz 50% -trim +repage -compress jpeg -quality 50 -format pdf -path "C:\output" "C:\input\*.tif"

I wanted in the same batch file to use the process above and then write a version in PDF jpeg compression and another in TIF compression LZW.
C:\output\PDF\0001.pdf
C:\output\TIF\0001.tif

Any suggestions?
Speed of processing is also essential.

Re: Is it possible to output 2 file formats using mogrify

Posted: 2018-09-12T13:21:09-07:00
by snibgo
Mogrify doesn't have the syntax to specify two different outputs for each input. For that, you need to use "convert" (or "magick" in V7) in a shell loop, such as "for".

Re: Is it possible to output 2 file formats using mogrify

Posted: 2018-09-12T13:32:43-07:00
by B_Gaspar
Thanks I already assumed that. I was trying to escape to do for loops.

In terms of speed of processing which is faster, the convert, magick or mogrify?

Re: Is it possible to output 2 file formats using mogrify

Posted: 2018-09-12T14:26:57-07:00
by snibgo
When processing a number of files, a "for" loop needs to invoke "magick" or "convert" for every file. This is done only once when using "mogrify" or "magick mogrify", so that saves time. But command invocation is usually trivial compared to the useful work done.

I've never compared V6 and V7 processing times. I guess that when using like-for-like (eg both Q16 integer), there is no difference. However, v6 by default is integer and v7 by default is HDRI, and that does make a difference.

Re: Is it possible to output 2 file formats using mogrify

Posted: 2018-09-12T15:12:58-07:00
by B_Gaspar
Just to establish my roadmap. I'm using IM Q8 because my images are greyscale and black and white, and I have seen in other posts that the 16bit version is slower than the Q8. What about the v7 HDRI. Is it faster?

Re: Is it possible to output 2 file formats using mogrify

Posted: 2018-09-12T15:31:25-07:00
by snibgo
For grayscale, v7 (which needs only one channel) may be faster than v6 (which needs 4 channels: RGB and A).

If speed concerns you, and you don't need HDRI, then don't use IM with HDRI.

A v6 speed test compares Q8 integer up to Q64 floating-point, overall a factor of 3. But aside from Q64, the differences are not large.

Incidentally, of course you can run mogrify twice: once to get PDF with JPEG, then to get TIF with LZW.

Re: Is it possible to output 2 file formats using mogrify

Posted: 2018-09-12T15:41:21-07:00
by B_Gaspar
Thanks a lot for the answers.