Hi,
I just started using ImageMagick-6.7.6-Q16 for creating thumbnails for large numbers of images.
I've been struggling though trying to get the "convert" and/or "mogrify" commands to output to folders and filenames that i want.
I have sort of gotten the results that i want by using "convert" but i'm having issues w/ that due to it crashing after running out of memory, i realize "mogrify" would be much preferable to use since it opens up each image one at a time - but mogrify doesn't like to use the "-set" flag which i've found necessary to get the output filename that i desire. I also need the thumbnails in a subfolder of the image's folder.
I'm calling convert like this currently (where my command is run in the subfolder where i want the output images to go)...
C:\ImageFolder\thumbs\convert "C:\ImageFolder\*.tga" -format png -thumbnail 64x64 -set filename:orig %f %[filename:orig].png
or
C:\ImageFolder\thumbs\convert @"C:\ImageFolder\createThumbs.txt" -format png -thumbnail 64x64 -set filename:orig %f %[filename:orig].png
So my questions:
1) is there a way for me to use mogrify and get the output filename to be the input file name w/ original ext plus the new ext. such as "blah.tga" would output to "blah.tga.png"
2) when calling convert or mogrify where i use a txt file to specify the files to convert, is there a way to get each individual output image to go to a subfolder of it's source image. such as i have images c:\FolderA\testA.tga and c:\FolderB\testB.tga listed in the txt file. i would want the output to be c:\FolderA\thumbs\testA.tga.png and c:\FolderB\thumbs\testB.tga.png
I'm currently limiting how many files i pass through to "convert" as a workaround for the memory issue, but that's a hack.
Some people may suggest other workarounds by using a batch file, but i'm limited w/ what i can do in that respect due to the fact that i'm calling these commands from another program and am limited in how i can call the command line from there.
Thanks for any help,
Command Line help controlling output name and folder
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Command Line help controlling output name and folder
I am not sure mogrify is that sophisticated. It is much more restrictive than convert.
The best way is to write a loop over each image in your directory and then output to your subdirectory.
Alternately, see
http://www.imagemagick.org/Usage/basics/#mogrify_not
The best way is to write a loop over each image in your directory and then output to your subdirectory.
Alternately, see
http://www.imagemagick.org/Usage/basics/#mogrify_not
Re: Command Line help controlling output name and folder
at this point i might as well just write out a long batch file (.bat) that has each file listed, and change the output subdir per image too...
cd c:\FolderA\thumbs
convert "C:\FolderA\testA.tga -format png -thumbnail 64x64 -set filename:orig %f %[filename:orig].png
cd c:\FolderB\thumbs
convert "C:\FolderB\testB.tga -format png -thumbnail 64x64 -set filename:orig %f %[filename:orig].png
etc...
i was hoping to avoid the overhead of calling "convert" over and over again, it must increase the time compared to just calling "mogrify".
this software seems so robust, i'm just surprised it doesn't have better control over output naming and folders.
anyone else have thoughts?
cd c:\FolderA\thumbs
convert "C:\FolderA\testA.tga -format png -thumbnail 64x64 -set filename:orig %f %[filename:orig].png
cd c:\FolderB\thumbs
convert "C:\FolderB\testB.tga -format png -thumbnail 64x64 -set filename:orig %f %[filename:orig].png
etc...
i was hoping to avoid the overhead of calling "convert" over and over again, it must increase the time compared to just calling "mogrify".
this software seems so robust, i'm just surprised it doesn't have better control over output naming and folders.
anyone else have thoughts?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Command Line help controlling output name and folder
Wait for Anthony to reply. He knows mogrify better than I.
- whugemann
- Posts: 289
- Joined: 2011-03-28T07:11:31-07:00
- Authentication code: 8675308
- Location: Münster, Germany 52°N,7.6°E
Re: Command Line help controlling output name and folder
I guess that you are working under Windows (?), soe you should use a FOR loop for your bulk conversion, see http://www.imagemagick.org/Usage/windows/#for_loops
Wolfgang Hugemann
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Command Line help controlling output name and folder
Note that mogrify will read and process each image ONE at a time
Convert however reads in ALL images before processing.
IMv7 will have more options, but I am no where near, looking to replace "mogrify" with the new "magick" command as yet.
But it will happen! Probably after I have implemented 'functions' Yes I have ideas for that sort of thing!
Convert however reads in ALL images before processing.
IMv7 will have more options, but I am no where near, looking to replace "mogrify" with the new "magick" command as yet.
But it will happen! Probably after I have implemented 'functions' Yes I have ideas for that sort of thing!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/