Rounded corners when size unknown

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Likao

Rounded corners when size unknown

Post by Likao »

i know many posts here deal with rounded transperent corners, and i read most of them, but all of them assume then the width/height are known and im dealing with special case where they are unknown, i can only use 1 commandline, so i cant use identify, is there any way of doing this ?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Rounded corners when size unknown

Post by Bonzo »

This is from a post a while ago - uses polygons but can be changed to use radii.

Code: Select all

convert  input.jpg ( +clone  -threshold -1 -draw "fill black polygon 0,0 0,30 30,0 fill white circle 30,30 30,0" ( +clone -flip ) -compose Multiply -composite  ( +clone -flop ) -compose Multiply -composite ) +matte -compose CopyOpacity -composite output.png");
Likao

Re: Rounded corners when size unknown

Post by Likao »

worked perfectly, thank you so much !
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Rounded corners when size unknown

Post by anthony »

That example and more is in IM examples...
Thumbnails, Adding Fluff, Rounded Corners
http://www.imagemagick.org/Usage/thumbnails/#rounded

The other technique, requiring the width and height of the image was an older method involving the use of the draw rounded rectangle method. It is also in the above, but is used for adding a border with rounded corners. That is you not only need to cut out the corners, but overlay an outline or frame. See Thumbnails, Framing Techniques, Border with Rounded Corners
http://www.imagemagick.org/Usage/thumbn ... ded_border

Also see the final example on that page...
Lighting Effects -- Glass Bubble
http://www.imagemagick.org/Usage/thumbnails/#lighting
This not only rounds the corners but add both light and dark shading effects to make it look like the image is in a 'glass bubble'.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply