Crop a JPG into a transparent circle PNG

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Posts: 1
Joined: 2020-03-20T16:35:38-07:00
Authentication code: 1152

Crop a JPG into a transparent circle PNG

Post by markcarey »

My goal is to take a JPG image and crop it into a circle, as a transparent PNG file. The follow command line works well for me:

Code: Select all

convert source.jpg \( +clone -threshold -1 -negate -fill white -draw "circle 640,640 640,0" \) -alpha off -compose copy_opacity -composite circle.png
.. But I am having trouble converting this into the equivalent code using PerlMagick. Thoughts?