Cropping to Center an Image and Doing This in a Batch
Posted: 2018-08-24T23:18:32-07:00
Alright, I've been searching for over an hour and slowly working my way through this.
My version is ImageMagick 7.0.8-10 Q16 x64 2018-08-14 being used on Windows 8.1 x64
First question is a curiosity, since I figured out a workaround, maybe. (Perhaps the workaround is giving me problems).
http://www.imagemagick.org/Usage/thumbnails/#square
This page let me see this code that I like
But the image always failed. It was almost like it was corrupted.
I instead used the longer form code given above it, and that worked.
So that first question: Why did the first code, which comes from the sample documentation, not work?
Second question, how do I batch name?
I've found stuff like this, including old forum posts, that say I could do something to the effect of
But that just spits out a single corrupted file called "square_internal_%[filename".... I've alternatively tried square_internal_*.gif with little hope, but that didn't work either.
So, how can I just process all the images in the directory but prefix their name?
The closest I can get so far is "square_internal_1.gif" "square_internal_2.gif" etc, losing the original file names.
My version is ImageMagick 7.0.8-10 Q16 x64 2018-08-14 being used on Windows 8.1 x64
First question is a curiosity, since I figured out a workaround, maybe. (Perhaps the workaround is giving me problems).
http://www.imagemagick.org/Usage/thumbnails/#square
This page let me see this code that I like
Code: Select all
convert thumbnail.gif -set option:size '%[fx:min(w,h)]x%[fx:min(w,h)]' \
xc:none +swap -gravity center -composite square_internal_2.gif
I instead used the longer form code given above it, and that worked.
Code: Select all
convert thumbnail.gif -set option:distort:viewport \
"%[fx:min(w,h)]x%[fx:min(w,h)]+%[fx:max((w-h)/2,0)]+%[fx:max((h-w)/2,0)]" \
-filter point -distort SRT 0 +repage square_internal.gif
Second question, how do I batch name?
I've found stuff like this, including old forum posts, that say I could do something to the effect of
Code: Select all
convert *.gif -set option:distort:viewport \
"%[fx:min(w,h)]x%[fx:min(w,h)]+%[fx:max((w-h)/2,0)]+%[fx:max((h-w)/2,0)]" \
-filter point -distort SRT 0 +repage square_internal_%[filename:f].gif
So, how can I just process all the images in the directory but prefix their name?
The closest I can get so far is "square_internal_1.gif" "square_internal_2.gif" etc, losing the original file names.