Page 1 of 1

make images web-ready through sub-folders

Posted: 2019-04-24T10:56:29-07:00
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

Re: make images web-ready through sub-folders

Posted: 2019-04-24T11:16:46-07:00
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.

Re: make images web-ready through sub-folders

Posted: 2019-04-24T11:38:36-07:00
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 :-)