Last active
June 25, 2019 17:25
-
-
Save lucnap/d4f8884b51d48d7af651bf3485fd2302 to your computer and use it in GitHub Desktop.
Resizing and Padding image to keep a constant aspect ratio with ImageMagick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Resizing and Padding image to keep a constant aspect ratio with ImageMagick | |
This command center any given image in an area of 768x1024 and resize to fit the aspect ratio 768x1024 | |
magick mogrify -resize 768x1024 -background "#fff" -gravity center -extent 768x1024 *Copia.jpg | |
Example Batch file, ResizeAndPadImage.bat | |
if not exist "out" mkdir out | |
magick mogrify -resize 768x1024 -background "#fff" -path "./out" -gravity center -extent 768x1024 %1 | |
and use with | |
ResizeAndPadImage.bat "c:\example\My Image1.jpg" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment