I am unsure if this is a bug, or just me having no idea what I'm doing-- I've been hammering at this for a bit with basically no knowledge on the system. Basically, I'm attempting to resize (on windows 10) all jpg files in a directory to the nearest power of 2 dimensions (lower, not higher). It, however, is throwing me some errors. I notice in said errors it shows the power of two dimensions, though-- so I hope I'm close. I'm rather horrid at coding, and I sort of patchworked a lot of different code I found through google- this seemed like it's pretty close, thus why I'm asking.
Code: Select all
FOR %a in (D:\Mods\Images\*.jpg) DO D:\Applications\ImageMagick\magick.exe %a -resize ${"%[fx:2^(ceil(log(w)/log(2)))/2]"}x${"%[fx:2^(ceil(log(h)/log(2)))/2]"} D:\Mods\Images2\%a
I am pasting this into command prompt, basically.
The errors are all along the lines of:
Code: Select all
C:\WINDOWS\system32>D:\Applications\ImageMagick\magick.exe D:\Mods\Images\httpiimgurcomztwkBXfjpg.jpg -resize ${"%[fx:2^(ceil(log(w)/log(2)))/2]"}x${"%[fx:2^(ceil(log(h)/log(2)))/2]"} D:\Mods\Images2\D:\Mods\Images\httpiimgurcomztwkBXfjpg.jpg
magick.exe: invalid argument for option '-resize' '${2048}x${1024}' at CLI arg 2 @ error/operation.c/CLISimpleOperatorImage/3170.