Page 1 of 1

Want image to be size of rounded-rectangle: without -size

Posted: 2007-08-10T09:52:35-07:00
by hknight
Hello,

I would like to create an image that is EXACTLY the size of my rounded-rectangle.

However this does NOT work:

Code: Select all

      convert xc:skyblue -fill white -stroke black \
      -draw "roundrectangle 20,10 80,50 20,15"  draw_rrect.gif
And this does NOT work either:

Code: Select all

      convert xc:skyblue -fill white -stroke black \
      -draw ""@rounded_corner.mvg" draw_rrect.gif
Those both give me an image that is ONLY 1px by 1 px.

I can NOT use the size attribute like this

Code: Select all

      convert -size 100x60 xc:skyblue -fill white -stroke black \
      -draw "roundrectangle 20,10 80,50 20,15"  draw_rrect.gif
because the size is created dynamically and placed into a mvg file.

Any ideas?
Thanks!

Thanks!

Re: Want image to be size of rounded-rectangle: without -size

Posted: 2007-08-12T23:46:51-07:00
by anthony
If you have the image size in the MVG file, why are you creating a one pixel image using xc: ?

Without a -size option xc: creates a single pixel image of the color specified.

I suggest you study IM Examples MVG file handling...
http://www.imagemagick.org/Usage/draw/#mvg_file

Re: Want image to be size of rounded-rectangle: without -size

Posted: 2007-08-13T03:26:33-07:00
by hknight
Thanks, Anthony.

Your direction enabled me create this, which works perfectly. The peice of the puzzle that I was missing was "viewbox"

Code: Select all

convert -background transparent -fill transparent \
           -font 'tahomabd.ttf' -pointsize 14 label:'Hello World \
           -format 'viewbox 0 0 %[fx:w] %[fx:h]  \
 fill white roundRectangle 1,1 %[fx:w-2] %[fx:h-2] \
 %[fx:int((w+h)/33)],%[fx:int((w+h)/33)]' \
            info: > rounded_corner.mvg

convert -background black +antialias rounded_corner.mvg mask.png

Re: Want image to be size of rounded-rectangle: without -size

Posted: 2007-08-13T16:37:32-07:00
by anthony
Your welcome.