Forked from ethanholda/gist:2a9a6c57092046721192309455d3af68
Last active
April 3, 2024 15:06
-
-
Save rduque1/269fee327144ff786b0907e223244ac0 to your computer and use it in GitHub Desktop.
imagemagick circular crop
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
# extract a circle from the image: translate to the middle of the image and define the radius to cut | |
convert IMG-TRM-1916-1038.jpg -alpha on -background none \( +clone -channel a -evaluate multiply 0 +channel -fill white -draw "translate 1500,1000 circle 0,0 0,150" \) -compose DstIn -composite -trim out.png | |
# convert a svg to png with resize the SVG to desired size | |
convert -background none -density 1536 -resize 4092x4092 roodwit.svg roodwitx4092_1536.png | |
# rounded rectangle crop | |
convert <image>.webp +repage -alpha on -background none \( +clone -channel a -evaluate multiply 0 +channel -fill white -draw "translate 225,225 roundrectangle 0,0 571,555 115,115" \) -compose DstIn -composite -trim out.webp | |
# resize image | |
convert out.webp -resize 80% out-small.webp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment