mogrify using @ and -path ... bug?
Posted: 2009-05-01T07:02:46-07:00
Hi,
I tried to use mogrify and the -path while reading the images from a list file using the @ option. This is because I want to avoid calling convert in a loop as it increases the processing time quite a lot when there are many images. The command line I tried was a variation of:
What happens is that all thumbnails get created in the same directory as the source images, in this case m:\pics, and are based on the filename of *ONLY* the first file in the list (which is deleted) *PLUS* a counter appended to the filename, before the extension. I wanted them to go in the "thumbs" subdirectory and have the filename and extension preserved.
Example, if list.txt contains the following:
then the the above command yields the following converted files:
The original pic1.jpg is deleted, pic2.jpg and pic3.jpg are not. The files are created in m:\pics and not in m:\pics\thumbs and all converted files are of the form pic1-*.jpg (note the pic1). However, the content of all converted files does correspond to the original files. It seems list.txt is indeed read correctly as per what conversion goes but the output file naming is only based on the first file in list from list.txt.
However, this seems to work fine:
but i can't use the above since my file list contains only a selection of files (the output of a script).
I could go around this by reading list.txt and create a one line string of file names which I then append to the mogrify command line but this would fail when the string goes beyond the command line length limit of the shell (32768 in my case) which happens easily when I have many hundreds of files as each line in list.txt is long'ish, containing the full path to the file.
Any ideas?
As a side note also (do prod me in case I'm missing something), IM is an incredibly advanced tool but it lacks one of the most basic features: processing of multiple files with filename format modifiers for the output files. Both convert and mogrify can read file names from a file with @ or from globbing a directory with e.g. *.jpg, so why not allow the user to specify the output directory and file based on the tokens from the input file, e.g. %b for basename, %f for file name, %e for extension, %p for path, etc ... outputting to a different directory would become much easier. Currently, I see IM insists on using counters and the output directory can only be specified for mogrify in that sense (i.e. when using @ or globbing and, for instance, when trying to just replicate the file names for the converted files in another directory).
Cheers and keep up the good work!
I tried to use mogrify and the -path while reading the images from a list file using the @ option. This is because I want to avoid calling convert in a loop as it increases the processing time quite a lot when there are many images. The command line I tried was a variation of:
Code: Select all
mogrify @list.txt -resize 100x100 -path m:\pics\thumbs
Example, if list.txt contains the following:
Code: Select all
m:\pis\pic1.jpg
m:\pis\pic2.jpg
m:\pis\pic3.jpg
Code: Select all
m:\pics\pic1-0.jpg
m:\pics\pic1-1.jpg
m:\pics\pic1-2.jpg
However, this seems to work fine:
Code: Select all
mogrify -resize 100x100 -path m:\pics\thumbs m:\pics\*.jpg
I could go around this by reading list.txt and create a one line string of file names which I then append to the mogrify command line but this would fail when the string goes beyond the command line length limit of the shell (32768 in my case) which happens easily when I have many hundreds of files as each line in list.txt is long'ish, containing the full path to the file.
Any ideas?
As a side note also (do prod me in case I'm missing something), IM is an incredibly advanced tool but it lacks one of the most basic features: processing of multiple files with filename format modifiers for the output files. Both convert and mogrify can read file names from a file with @ or from globbing a directory with e.g. *.jpg, so why not allow the user to specify the output directory and file based on the tokens from the input file, e.g. %b for basename, %f for file name, %e for extension, %p for path, etc ... outputting to a different directory would become much easier. Currently, I see IM insists on using counters and the output directory can only be specified for mogrify in that sense (i.e. when using @ or globbing and, for instance, when trying to just replicate the file names for the converted files in another directory).
Cheers and keep up the good work!