Page 1 of 1

Using wildcards from tif to jpg

Posted: 2008-08-28T02:57:11-07:00
by rpgomes
Hi,

The 'convert "*.tif" -thumbnail 250x90 -unsharp 0x.5 "output\*.jpg"' command line return "unable to open image `output\*-0.jpg': Invalid argument".
I can't find any post or manual entry regarding why the error and why:

- The convert error
- It is trying to add the "-0" sufix to the filename

I'm using 6.4.2-5 version on Windows XP.

Thank you
Rui Gomes

Re: Using wildcards from tif to jpg

Posted: 2008-08-28T11:15:38-07:00
by fmw42
convert syntax does not allow * wildcards (as far as I know)

You can use %d in output file names.

See
viewtopic.php?f=1&t=6480&hilit=wild+card
http://www.imagemagick.org/Usage/files/#write_seq

You can use mogrify.

See
http://www.imagemagick.org/Usage/basics/#mogrify

Re: Using wildcards from tif to jpg

Posted: 2008-08-28T18:45:44-07:00
by anthony
fmw42 wrote:convert syntax does not allow * wildcards (as far as I know)
In the output format!!!!! In input it supports ~, * and ? wildcard meta characters. It alsi supports a Im specific wildcard @ to read a list of images from a file.

In both Input and ouptut, %d can be used, though will be added automatically as -%d before the suffix if the image format does not support multiple images per file (-adjoin which is enabled by default).

See IM examples, Writing Multiple Image Files

Re: Using wildcards from tif to jpg

Posted: 2008-08-28T19:02:41-07:00
by fmw42
anthony wrote:
fmw42 wrote:convert syntax does not allow * wildcards (as far as I know)
In the output format!!!!! In input it supports both * and ? wildcard meta characters.

See IM examples, Writing Multiple Image Files

Can you clarify the use of * and ? for input or point me to examples on your pages?

Thanks.

Re: Using wildcards from tif to jpg

Posted: 2008-08-28T20:01:34-07:00
by anthony
Image File Handling, Reading Images
http://www.imagemagick.org/Usage/files/#read

It is done because the DOS shell does not expand those characters, so IM has to support at least that minimal requirement!

Shell expandsion under more advanced shells like BASH, CSH, TCSH, KSH etc also allow the use of [...] character alternatives and {..,..,..} string alternative expansion too. IM does not, though it has its own [...] read modifiers. See the above link.

In fact everything in this discussion is in that page of IM Examples!

Re: Using wildcards from tif to jpg

Posted: 2008-08-29T03:31:22-07:00
by rpgomes
I used wildcards on input files and d% option on output.
I made several tests and I never got an output file equal than input.
I found another posts with the same problem, but with no anwsers. I look on IM examples but, sorry, I can't find how can I get equal input and output filenames.

Is there any way to do this in DOS shell?

Thanks

Re: Using wildcards from tif to jpg

Posted: 2008-08-31T21:58:28-07:00
by anthony
rpgomes wrote:I used wildcards on input files and d% option on output.
I made several tests and I never got an output file equal than input.
At this time only mogrify allows you to save a file to the same input filename
with only a directory or suffix change.

Convert does not have the ability to use say '%s' to specify the original basename
of the image :-(
I found another posts with the same problem, but with no anwsers. I look on IM examples but, sorry, I can't find how can I get equal input and output filenames.
The only way is to DIY it using a wrapping shell, or other program (like PHP)

See example for UNIX shells in Mogrify, Batch Processing Alternatives
For DOS you will need to find someone more familiar with its scripting methodology.

Re: Using wildcards from tif to jpg

Posted: 2012-05-16T07:04:34-07:00
by fkjt79
anthony wrote:
rpgomes wrote:I used wildcards on input files and d% option on output.
[...]
Convert does not have the ability to use say '%s' to specify the original basename
of the image :-(
[...]
+1 this would be very useful to use with wildcards

Re: Using wildcards from tif to jpg

Posted: 2012-05-20T22:36:43-07:00
by anthony
fkjt79 wrote:
anthony wrote:
rpgomes wrote:I used wildcards on input files and d% option on output.
[...]
Convert does not have the ability to use say '%s' to specify the original basename
of the image :-(
[...]
+1 this would be very useful to use with wildcards

Sorry I am wrong - and my own examples prove it.
You can use the input filename (basename, or whatever), but you have to 'prepare' IM to do so as a security measure.
See http://www.imagemagick.org/Usage/files/#save_escapes

Also see Using Convert Instead of Morgify
http://www.imagemagick.org/Usage/basics ... fy_convert

Mogrify does this automatically, but works on one input image file at a time. Convert however reads all the input images first and then processes them.