Page 1 of 1

Multiple saves

Posted: 2009-11-06T03:37:08-07:00
by dargaud
Hello all,
I'm learning the basics of scripting with IM.
Is there a way to optimize the following into a single convert operation since I always start from the same source file:

Code: Select all

convert Source.jpg ...operations1... Dest1.jpg
convert Source.jpg ...operations2... Dest2.jpg
convert Source.jpg ...operations3... Dest3.jpg
And two side questions:
  • I saw it's possible to do general floating point maths with IM with "%[...]" but where is the complete explanation (syntax, list of functions, etc) about that ?
  • is there a way to get write support for the DNG format ? (something else to install / compile ?) I'm on Ubuntu.

Re: Multiple saves

Posted: 2009-11-06T05:46:10-07:00
by Bonzo
Try:

Code: Select all

convert Source.jpg ( +clone -thumbnail x480 -write Dest1.jpg +delete ) ( +clone -thumbnail x250 -write Dest2.jpg +delete ) -thumbnail Dest3.jpg
or

Code: Select all

convert Source.jpg -write mpr:image +delete ( mpr:image -thumbnail x480 Dest1.jpg ) ( mpr:image -thumbnail x250 -write Dest2.jpg )  ( mpr:image -colorspace Gray -write Dest3.jpg  )");

Re: Multiple saves

Posted: 2009-11-08T17:36:05-07:00
by dargaud
Thanks, that would have been hard to figure out. Actually, after some tests I'm not convinced this is much faster than the simpler multiline command.

Re: Multiple saves

Posted: 2009-11-08T17:57:02-07:00
by anthony
It is faster as it performs the exact same operations, but only reads the source image once.
It also saves of start up processing (loading commands, libraries etc) needed.

Depending on the operations you may also gain speed by not needing to save and re-read intermediate image files, which not only can take time, and is generally slow due to disk IO, but also can introduce loss of accuracy as image files format usually are 8 bit depth, when default in memory store is a 16 bit depth.

In fact, not saving intermediate files become a crucial part for very advanced fourier transform image processing techniques using HDRI (floating point).