How to get rounded corner for given MagicImage #1805
Unanswered
pchandoria
asked this question in
Help
Replies: 1 comment
-
We are in 2025 and still there is no simple working solution to get rounded corner using MagicImage. Shouldn't it be a simple API using drawable? I tested solution discussed in #253, unfortunately it does nothing actually. for the original image something like this |
Beta Was this translation helpful? Give feedback.
0 replies
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
-
There is no clear information available on how to get rounded corner for given image.
Somewhere on the internet I found this suggestion but I have to idea how to map it equally to .NET. Besides that it should be really simple API similar to css border-radius
magick thumbnail.gif
( +clone -alpha extract
-draw 'fill black polygon 0,0 0,15 15,0 fill white circle 15,15 15,0'
( +clone -flip ) -compose Multiply -composite
( +clone -flop ) -compose Multiply -composite
) -alpha off -compose CopyOpacity -composite rounded_corners.png
I also tried this
new Drawables().RoundRectangle(0, 0, width, height, 10, 10).Draw(magicImage);
but it actually rendered rounded corner black image with corners showing actual image. I guess we just need to flip it and set corner transparent.
Please help.
Beta Was this translation helpful? Give feedback.
All reactions