Last active
December 19, 2018 18:17
-
-
Save akagr/0560e0873b4d0a95262e94f9ffee16ee to your computer and use it in GitHub Desktop.
Squares up rectangular images by filling empty space with blur of same image
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
# To get the resolution, multiply 118 by cm. For example, 7 cm image at 300ppi will be 7 * 118 = 826 px | |
RESOLUTION=826 | |
convert $1 -resize ${RESOLUTION}x${RESOLUTION}^ -gravity center -crop ${RESOLUTION}x${RESOLUTION}+0+0 +repage -blur 0x8 temp.jpg | |
convert temp.jpg $1 -resize ${RESOLUTION}x -gravity center -composite -matte "./output/$1-out.jpg" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample usage
Example output: