On Tue, 13 Oct 2009 12:03:03 -0500 David Favor <[email protected]> wrote:
| On the page: | | http://www.imagemagick.org/Usage/thumbnails/#rounded_border | | the example syntax breaks down rapidly when larger images and | border widths are used. | | Maybe I'm misunderstanding something. | | I have a set of large images which require different rounded | corner frames being used. | | Here's the test syntax I'm using, with commands numbered... | | # (#1) create a red rectangle of the size of one image | convert -size 2736x1830 xc:red red.gif | | # (#2) create the magic graphics file which appears to require 'w-...' and 'h-...' | # to match border amount to even get close to creating a working frame | convert red.gif -border 100 -format \ | 'roundrectangle 1,1 %[fx:w-100],%[fx:h-100] 159,159' \ | info: > tmp.4755.1.rounded_corner.mvg | | # mvgfile == roundrectangle 1,1 2836,1930 159,159 | WRONG!!!! The rectangle is defined with the points given being in the 'center' of the stroked frame. As the frame has a width, then these coordinates will need to be adjusted. That is in the above 1,1 should be the 'center' of the rectangle frame, NOT the outside or even the inside edge of that frame. NOTE coodinates in 'draw' commands are in pixel coodinates That is position 0,0 means the center of pixel 0,0 which in image (or mathematical) coordinates is position 0.5,0,5 The 1,1 in the original example was appropriate for a stroke width of 3 Your image is 2736x1830 your stroke width is 100 Assuming you want only the minimum amount of the image cropped, then you will want to position your image 100 pixel inward from the edge of final image which will be 200 pixels larger than the original image. New image size = 2936x2030 with a +100+100 offset for positioning. The rounded rectangle will need to be centered in the broder area. That is it is 50 pixels from the edge (in image coodinates). Thus doing the math places the rectangle at pixel coordinates 49.5,49.5 and 2885.5,1979.5 That first number is strokewdith - 0.5 the send numbers is (width,height) + strokewidth*1.5 -0.5 or + 149.5 on the image size The -border is NOT needed for the calculation, but is still needed for the generation of the two masks and the overlays, to provide the right amount of space needed convert red.gif \ -format 'roundrectangle 49.5,49.5 %[fx:w+149.5],%[fx:h+149.5] 159,159' \ info: > tmp.4755.1.rounded_corner.mvg I have updated the original examples to try to explain these calculations. http://www.imagemagick.org/Usage/thumbnails/#rounded_border The changes should be up in a couple of hours. Anthony Thyssen ( System Programmer ) <[email protected]> ----------------------------------------------------------------------------- Base 8 is just like base 10 really... ...if you're missing two fingers. - Tom Lehrer ----------------------------------------------------------------------------- Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/ _______________________________________________ Magick-users mailing list [email protected] http://studio.imagemagick.org/mailman/listinfo/magick-users
