Method
VipsImageaffine
Declaration [src]
int
vips_affine (
VipsImage* in,
VipsImage** out,
double a,
double b,
double c,
double d,
...
)
Description [src]
This operator performs an affine transform on an image using interpolate.
The transform is:
X = @a * (x + @idx) + @b * (y + @idy) + @odx
Y = @c * (x + @idx) + @d * (y + @idy) + @doy
where:
x and y are the coordinates in input image.
X and Y are the coordinates in output image.
(0,0) is the upper left corner.
The section of the output space defined by oarea is written to
out. oarea is a four-element int array of left, top, width, height.
By default oarea is just large enough to cover the whole of the
transformed input image.
By default, new pixels are filled with background. This defaults to
zero (black). You can set other extend types with extend.
VipsExtend is better for image upsizing.
interpolate defaults to bilinear.
idx, idy, odx, ody default to zero.
Image are normally treated as unpremultiplied, so this operation can be
used directly on PNG images. If your images have been through
vips_premultiply(), set premultiplied.
This operation does not change xres or yres. The image resolution needs to be updated by the application.
::: tip “Optional arguments”
* interpolate: VipsInterpolate, interpolate pixels with this
* oarea: VipsArrayInt, output rectangle
* idx: gdouble, input horizontal offset
* idy: gdouble, input vertical offset
* odx: gdouble, output horizontal offset
* ody: gdouble, output vertical offset
* extend: VipsExtend, how to generate new pixels
* background: VipsArrayDouble colour for new pixels
* premultiplied: gboolean, images are already premultiplied
::: seealso
vips_shrink(), vips_resize(), VipsInterpolate.
Parameters
out |
VipsImage |
Output image. |
|
| The argument will be set by the function. | |
| The instance takes ownership of the data, and is responsible for freeing it. | |
a |
double |
Transformation matrix coefficient. |
|
b |
double |
Transformation matrix coefficient. |
|
c |
double |
Transformation matrix coefficient. |
|
d |
double |
Transformation matrix coefficient. |
|
... |
none |
|