Does mogrify accept wildcards and percent escapes?
Posted: 2018-07-16T02:58:27-07:00
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:
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:
image.bat:
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
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"
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"
Code: Select all
magick mogrify "%~1" -fill white -pointsize 30 -gravity northwest -annotate 0 %~2 C:\Users\pablo\try\%~2.TIFF
Thank you in advance :)
Winx64, ImageMagick 7.0.8-6 q16 x64, i7 770HQ, GTX 1050 4GB