Page 1 of 1

Rounded corners when size unknown

Posted: 2010-06-22T23:18:26-07:00
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 ?

Re: Rounded corners when size unknown

Posted: 2010-06-23T00:03:05-07:00
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");

Re: Rounded corners when size unknown

Posted: 2010-06-23T03:21:39-07:00
by Likao
worked perfectly, thank you so much !

Re: Rounded corners when size unknown

Posted: 2010-06-23T16:16:40-07:00
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'.