Page 1 of 2
Round corners
Posted: 2010-06-27T15:38:13-07:00
by kaktusyaka
Hi
Pleasy, help me change the angle corners to round ones
Code: Select all
convert thumbnail.gif -alpha set -compose DstOut \
\( -size 20x10 xc:none -draw "polygon 0,0 0,9 19,0" \
-write mpr:triangle +delete \) \
\( mpr:triangle \) -gravity northwest -composite \
\( mpr:triangle -flip \) -gravity southwest -composite \
\( mpr:triangle -flop \) -gravity northeast -composite \
\( mpr:triangle -rotate 180 \) -gravity southeast -composite \
corner_cutoff.png
Thanks!!
Re: Round corners
Posted: 2010-06-27T18:08:04-07:00
by fmw42
Re: Round corners
Posted: 2010-06-28T01:30:14-07:00
by kaktusyaka
Thanks. But I want round only top-left and bottom-right corners.
Re: Round corners
Posted: 2010-06-28T01:36:26-07:00
by kaktusyaka
Actually I need to round out all combinations of angles (for example: the upper left and lower right or lower right, upper right and lower left, etc.)
Thanks for your help
Re: Round corners
Posted: 2010-06-28T11:01:09-07:00
by fmw42
create a rounded corner all around. then crop one corner and rotate appropriately and composite it over all the corners you want in your original image.
Re: Round corners
Posted: 2010-06-28T11:07:08-07:00
by kaktusyaka
> create a rounded corner all around. then crop one corner and rotate appropriately and composite it over all the corners you >want in your original image.
I not well in imagemagick. Can you write me example of this command?
Thanks!!!
Re: Round corners
Posted: 2010-06-28T11:29:53-07:00
by Bonzo
Re: Round corners
Posted: 2010-06-28T11:35:47-07:00
by fmw42
convert thumbnail.gif \( +clone -alpha extract \
\( -size 15x15 xc:black -draw 'fill white circle 15,15 15,0' -write mpr:arc +delete \) \
\( mpr:arc \) -gravity northwest -composite \
\( mpr:arc -flip \) -gravity southwest -composite \
\( mpr:arc -flop \) -gravity northeast -composite \
\( mpr:arc -rotate 180 \) -gravity southeast -composite \) \
-alpha off -compose CopyOpacity -composite rounded_corners.png
just pick and remove which of the four -gravity lines you want to delete so as to leave the rounded corners you want
So to get only the UL and BR corners use:
convert thumbnail.gif \( +clone -alpha extract \
\( -size 15x15 xc:black -draw 'fill white circle 15,15 15,0' -write mpr:arc +delete \) \
\( mpr:arc \) -gravity northwest -composite \
\( mpr:arc -rotate 180 \) -gravity southeast -composite \) \
-alpha off -compose CopyOpacity -composite rounded_corners2.png
This may not be the most efficient way, but it is one way to do it.
Re: Round corners
Posted: 2010-06-28T21:54:06-07:00
by kaktusyaka
Its work!!!!
The many thanks for your help!!!!!!!!
Re: Round corners
Posted: 2011-06-18T15:13:33-07:00
by marciano
Hello.
I get "convert: unrecognized option `-alpha'."
My version is 6.2.8.0-4.el5_5.3
How can I solve it.
I need rounded corners and a soft image shadow.
Thank you
Re: Round corners
Posted: 2011-06-18T16:15:59-07:00
by fmw42
marciano wrote:Hello.
I get "convert: unrecognized option `-alpha'."
My version is 6.2.8.0-4.el5_5.3
How can I solve it.
I need rounded corners and a soft image shadow.
Thank you
Your version of IM is way too old (over 400 versions old). You should try to upgrade. If not, then the problem is -alpha extract is too new. So try
convert thumbnail.gif \( +clone
-channel a -separate +channel -negate \
\( -size 15x15 xc:black -draw 'fill white circle 15,15 15,0' -write mpr:arc +delete \) \
\( mpr:arc \) -gravity northwest -composite \
\( mpr:arc -flip \) -gravity southwest -composite \
\( mpr:arc -flop \) -gravity northeast -composite \
\( mpr:arc -rotate 180 \) -gravity southeast -composite \) \
-alpha off -compose CopyOpacity -composite -compose over \
\( +clone -background black -shadow 80x3+5+5 \) \
+swap -background none -mosaic rounded_corners_shade_1.png
see
http://www.imagemagick.org/Usage/thumbnails/#rounded
http://www.imagemagick.org/script/comma ... hp?#shadow
http://www.imagemagick.org/Usage/blur/#shadow
http://www.imagemagick.org/Usage/thumbnails/#shadow
http://www.imagemagick.org/Usage/thumbn ... ded_border
Re: Round corners
Posted: 2011-06-19T09:52:05-07:00
by marciano
Hello, thanks for your help.
Regrettably this is the 'up-to-date' version from my Centos 5.6 repo
This is web server I prefer not to make upgrades by myself.
Imagick php extension makes the script write quite simple but I also get the same out-to-date problem.
In your example I get this error msg
convert: image sequence is required `+clone'
Thank you
PS: the option alpha is still in this command
Re: Round corners
Posted: 2011-06-19T11:16:51-07:00
by fmw42
try my modified command earlier that does not use -alpha extract. see the part in blue.
Re: Round corners
Posted: 2011-06-19T16:57:38-07:00
by fmw42
Re: Round corners
Posted: 2019-08-15T14:00:00-07:00
by redunbar
I have tried the method you suggested, using the -alpha extract version. It does exactly what I needed, but seems extremely slow. I'm relatively new to Imagemagick, so I don't understand it completely yet. Is there a way to to create the mask and save it for reuse, thus saving the time it takes to create the mask each time? In my application, which is creating modified images to be applied to t-shirts, I need to run it against potentially thousands of images, and as it stands, as an octogenarian, I doubt I'll live long enough to finish the project.