Hey there.
So trying to keep two up to date versions of tiles at 50px and 100px is a pain. Clearly the better plan is to keep the 100px one up to date and then copy and resize this directory whenever I update. I must be able to do this using basic DOS scripts and imagemagick, but I can't figure it out for the life of me.
The imagemagick command is actually pretty straightforward:
mogrify -resize 50% *.png
The one problem I have with this is that it results the correct sized image in pixels, but no real gain in filesize. Any thoughts?
However the real trouble here is the DOS scripting required to run this on a folder and and all of its subdirectories. Any ideas? Any help much appreciated - and rewarded with a healthy dose of rep
Imagemagick help (well really a DOS scripting question)
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Imagemagick help (well really a DOS scripting question)
I have moved this post, since the Consulting forum is for PAID consulting only.
I suggest you Google about Windows batch scripting as this forum is not really about scripting but about Imagemagick processing. However, you may get lucky and one of the Windows users may provide help. Sorry, I am not a PC/Window/DOS user, so cannot help you.
I suggest you make a list of directories and use a for loop over each directory and use mogrify to process each directory. Imagemagick mogrify will not traverse subdirectories.
See for example https://ss64.com/nt/for.html and https://www.computerhope.com/forhlp.htm There are plenty of resources out there on the web.
Depending upon your input type and color depth, file size might increase or not decrease by much when using -resize, since it creates new pixels from the resampling.
You have not informed us about the color depth of your input images?
I suggest you Google about Windows batch scripting as this forum is not really about scripting but about Imagemagick processing. However, you may get lucky and one of the Windows users may provide help. Sorry, I am not a PC/Window/DOS user, so cannot help you.
I suggest you make a list of directories and use a for loop over each directory and use mogrify to process each directory. Imagemagick mogrify will not traverse subdirectories.
See for example https://ss64.com/nt/for.html and https://www.computerhope.com/forhlp.htm There are plenty of resources out there on the web.
Depending upon your input type and color depth, file size might increase or not decrease by much when using -resize, since it creates new pixels from the resampling.
You have not informed us about the color depth of your input images?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Imagemagick help (well really a DOS scripting question)
Windows BAT syntax:
For help on "for", type "help for" at the command prompt.
Code: Select all
for /R %%F in (.) do (
pushd %%~pF
mogrify -resize 50%% *.png
popd
)
snibgo's IM pages: im.snibgo.com