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?".
I need to resize multiple images in subfolders. If width<2000 then resize to 1440x2200 and other files to 2880x2200. But i'm getting all files in 1440x2200 and need help
@echo off
echo Resizing...
pushd %1
set "%%x==2000"
for /f "delims=" %%n in ('dir /b /s /a-d-h-s') do ("%~dp0identify.exe" -ping -format "%%w" "%%n") & If "%%w" lss "%%x" ("%~dp0mogrify.exe" -resize 1440x2200! "%%n") Else ("%~dp0mogrify.exe" -resize 2880x2200! "%%n")
popd
echo All done!
pause
This won't set environment variable w, as you will discover if you run it with a filename instead of %%n. Within identify format, "%%w" means "find the width".
That command returns an integer (ie it sends the integer to stdout). If you want to capture the integer into an environment variable (I will use WW to reduce confusion) do something like this: