make images web-ready through sub-folders

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
superknutsel
Posts: 2
Joined: 2019-04-24T05:56:14-07:00
Authentication code: 1152
Location: Netherlands

make images web-ready through sub-folders

Post by superknutsel »

Hi,
I'll start with my setup:
Windows 10 with the portable version of IM version 7.0.5-5 Q16 running commands from a .bat file

I've been resizing images for some time but normally from 1 folder. All works fine for me at that point.

Now I would love to get the same results but then using images in sub-folders. This is where I tried many but not succeeded (yet).
The command I used in my .bat file is this :
..\ImageMagick-portable\mogrify.exe -path ..\1200\ -verbose -resize 1200x1200 -auto-orient -quality 60 -density 72x72 -gravity center -extent 1200x1200 ..\_img-todo\*.jpg

I have been trying with several looping commands trying to make it work but no luck. It could be right in front of me... or out of my league :D
Because I tried so many I'm not going to display them all unless requested because maybe somebody knows a way to make my original command work?

Any tips are more then welcome and much appreciated.
Nico
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: make images web-ready through sub-folders

Post by snibgo »

IM knows nothing about subdirectories. I suggest you write a shell "for" loop. Within that loop, you can call any script or run any command you want, using the loop variable name as a subdirectory name.
snibgo's IM pages: im.snibgo.com
superknutsel
Posts: 2
Joined: 2019-04-24T05:56:14-07:00
Authentication code: 1152
Location: Netherlands

Re: make images web-ready through sub-folders

Post by superknutsel »

Yes I know, I've been trying to create something that loops but not being a programmer only made my eyeballs loop.

Tried this approach I found in the forum :
for /r "C:\Users\N\Desktop\IM-in" %a in (*.*) do ..\ImageMagick-portable\mogrify.exe -verbose -resample 72 -resize 800x800 -format jpg "%~a
but that did not do anything (and I'm certain it's me...).
I also found a PowerShell script that I'm going to try if I cannot get my head around this.
Or maybe hire somebody to help me out if that's possible :-)
Post Reply