0

I am creating a rounded rectangle mask using

convert -size 256x256 xc:none -draw "roundrectangle 0,0,256,256,47,47" mask.png

This works fine. However using the same command for 16x16 as follows

 convert -size 16x16 xc:none -draw "roundrectangle 0,0,16,16,3,3" mask.png

produces a mask.png in which the rounded corners don't look correct. Infact top left corner looks ok and bottom right corner looks distorted.

My convert version is

Version: ImageMagick 6.8.9-6 Q16 i586 2014-09-06 http://www.imagemagick.org

For each image the rounded radius is 47/256 ~= 3/16 ~= 18%

Am I not running the commands correct or are these artifacts expected? Could this be imagemagick limitation.

My final aim is to use this mask and composite it to make an application icon for various sizes ranging from 16x16 all the way to 1024x1024. Since the mask is created wrong so are the final icons when compositing.

sachinkundu
  • 35
  • 1
  • 5

1 Answers1

1

This is more related to a basic canvas overflow. Just remember that an array of pixels starts at 0 and ends at n-1 (where n is the size of the array.)

array index

If you draw on an image with the size 16x16, the first pixel will have a access coordinate of 0,0 and a the last pixel at 15,15. This is the same with your first example, but the image & curve is large enough not to notice the last pixel is trimmed off.

convert -size 16x16 xc:none -draw "roundrectangle 0,0,15,15,3,3" mask.png
emcconville
  • 23,800
  • 4
  • 50
  • 66