P.S.

PHP may have trouble with the back quotes. So you may need to use PHP 
commands to build the string. First get the width and height into PHP 
variables, then subtract 4 from each, then compose the string for 
drawcmd="roundrectangle 1,1 $wm4,$hm4 15,15"

Fred



Here is how I would do it in unix IM using a string "drawcmd" to 
replace the mvg file. You need to create the drawcmd string first in 
one command and then all the processing is done in the next long 
command.


infile="thumbnail.gif"
drawcmd=`convert $infile -format "roundrectangle 1,1 
%[fx:w+4],%[fx:h+4] 15,15" info:`
convert \( $infile -matte -bordercolor none -border 3 \) \
\( +clone -alpha transparent -background none \
-fill white -stroke none -strokewidth 0 -draw "$drawcmd" \) \
-compose DstIn -composite \
\( +clone -alpha transparent -background none \
-fill none -stroke black -strokewidth 3 -draw "$drawcmd" \) \
-compose Over -composite thumbnail_rounded_border_in_one.gif



Fred


>Hi Fred,
>In Noel's original version his third command writes the result of 
>-format to standard output into a .MVG file. That file is then input 
>to a -draw in the fourth command.
>He is following the example at:
>http://www.imagemagick.org/Usage/thumbnails/#rounded_border
>
>His original commands were:
>     <?
>     $command = "convert image.gif -resize 1000x1000 /tmp/image.png";
>     shell_exec($command);
>
>     $command2 = "convert /tmp/image.png -thumbnail 80x80 /thumbs/2.jpg";
>     shell_exec($command2);
>
>     $command3 "convert  /thumbs/2.png -border 2 -format 'roundrectangle
>1,1 %[fx:w-2],%[fx:h-2] 15,15' info: > /tmp/rounded_corner.mvg";
>     shell_exec($command3);
>
>     $command4 "convert /thumbs/2.png -border 2 -matte -channel RGBA -
>threshold -1 -background none -fill white -stroke black -strokewidth 1
>-draw "@/tmp/rounded_corner.mvg" /tmp/rounded_corner_mask.png";
>     shell_exec($command4);
>
>     $command5 "convert /thumbs/2.png -matte -bordercolor none -border 2 /
>tmp/rounded_corner_mask.png -compose DstIn -composite  -depth 8 -
>quality 95 /thumbs/2.png";
>     shell_exec($command5);
>     ?>
>
>Best Wishes
>Pete
>
>
>--- On Fri, 1/15/10, Fred Weinhaus <[email protected]> wrote:
>
>>  From: Fred Weinhaus <[email protected]>
>>  Subject: Re: [magick-users] chaining
>>  To: "Pete Whatever" <[email protected]>
>>  Date: Friday, January 15, 2010, 1:14 PM
>>  > Hi Fred,
>>  > I looked at those commands and could compress it down
>>  to two commands. The problem is that the third command
>>  writes info to standard output which is then used in a later
>>  command. Is there a way to avoid writing that info to
>>  standard output in command3?
>>  >
>>  > Best Wishes
>>  > Pete
>>  >
>>  >
>>  >
>>  >
>>
>>
>>  Hi Pete,
>>
>>  I am not sure where you have to write to standard output. I
>>  don't see that in your commands nor in the examples at 
>>http://www.imagemagick.org/Usage/thumbnails/#rounded
>>
>>  Can you show me your command or point out where this is
>>  occurring? Also why not just use the commands as is from the
>>  rounded corner example and just change the names of the
>>  files?
>>
>>  Are you trying to do the rounded corner thing or am I
>>  misunderstanding what you are after. Do you have an example
>>  of what you want to do?
>>
>>
>>  Fred
>>
>
>
>
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to