Using wildcards from tif to jpg

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
rpgomes

Using wildcards from tif to jpg

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Using wildcards from tif to jpg

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Using wildcards from tif to jpg

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Using wildcards from tif to jpg

Post 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.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Using wildcards from tif to jpg

Post 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!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
rpgomes

Re: Using wildcards from tif to jpg

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Using wildcards from tif to jpg

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
fkjt79
Posts: 7
Joined: 2012-04-11T07:58:39-07:00
Authentication code: 8675308

Re: Using wildcards from tif to jpg

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Using wildcards from tif to jpg

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply