Does mogrify accept wildcards and percent escapes?

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
pablowako
Posts: 1
Joined: 2018-07-16T02:34:02-07:00
Authentication code: 1152

Does mogrify accept wildcards and percent escapes?

Post by pablowako »

Hello!
I have a large (+18000) batch of .TIFFs I need to process. I want to burn the [Image name] onto the image itself. I have already tried FFmpeg, but someone told me magick could be faster.
I'm having trouble getting the code to work. I have tried using a [forfiles] loop already, but it's much slower than FFmpeg. So, I went with mogrify.
My issue is that mogrify doesn't like my wildcards (C:\path\*.TIFF) nor my escape (%f for filename, see on the code below). When I do it image by image, it works fine and dandy, and magick understands %f as it's supposed to (the file's name as string). BUT when I use mogrify to batch process the whole thing... Nope.

Here's my code, just in case:

Code: Select all

magick mogrify "C:\Users\pablo\Desktop\try\*.TIFF" -fill white -pointsize 30 -gravity northwest -annotate 0 %f "C:\Users\pablo\Desktop\try\*.TIFF"
So this should take all .TIFFs in the folder "try" one by one, annotate each file's filename (%f) and export it in the same folder, overwriting the inputs.
I also tried not giving it an output, giving it a different one... nothing.

This forfiles loop works:
master.bat:

Code: Select all

forfiles /p "C:\Users\pablo\try" /m "*.TIFF" /S /C "cmd /c C:\Users\pablo\Desktop\image.bat @file @fname"
image.bat:

Code: Select all

magick mogrify "%~1" -fill white -pointsize 30 -gravity northwest -annotate 0 %~2 C:\Users\pablo\try\%~2.TIFF
What am I doing wrong? Does mogrify simply not take escapes and wildcards? What alternative do I have?

Thank you in advance :)

Winx64, ImageMagick 7.0.8-6 q16 x64, i7 770HQ, GTX 1050 4GB
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Does mogrify accept wildcards and percent escapes?

Post by snibgo »

See the mogrify documentation http://www.imagemagick.org/script/mogrify.php

The input file, possibly with wildards, is given once, at the end of the command line. The output filename is not given because that is the same as the input filename.
snibgo's IM pages: im.snibgo.com
Post Reply