[RESOLVED]vignette offsets x and y

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

[RESOLVED]vignette offsets x and y

Post by fmw42 »

I was experimenting with -vignette to see what the x and y offsets do, so that I could modify the documentation.

They would appear to change the radius of the base ellipse for the vignette before applying the blur. From the code of vignetteImage, at about line 5492:

Code: Select all

  (void) FormatLocaleString(ellipse,MaxTextExtent,
    "ellipse %g,%g,%g,%g,0.0,360.0",image->columns/2.0,
    image->rows/2.0,image->columns/2.0-x,image->rows/2.0-y);
But I cannot find the default values for x and y. They are not zero as demonstrated by the following. And they do not appear to be either a fixed amount in either pixels or percent. For the size 200x200, either 20 pixel or 20%x100 radius = 20 pixels and both match the default. But at 400x400 neither 20 pixels nor 20% seem to match. Perhaps the percent is not working correctly, since both 20 pixels and 20% give the same result (but do not match the default except at 200x200)

convert -size 200x200 xc:black -vignette 0x0 -negate circle_defaultoffsets.jpg
Image

convert -size 200x200 xc:black -vignette 0x0+0+0 -negate circle_zerooffsets.jpg
Image


Can someone tell me what the default x and y values are? I know they must be positive so that the circle is made smaller
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: vignette offsets x and y

Post by fmw42 »

I found it. It is 10% of the width and 10% of the height of the image.

Code: Select all

      if ((flags & XiValue) == 0)
        geometry_info.xi=0.1*(*image)->columns;
      if ((flags & PsiValue) == 0)
        geometry_info.psi=0.1*(*image)->rows;
Post Reply