Transform
Applies linear transformations to an image, such as scaling, rotation, skewing, or warping, altering its shape or orientation.
ðžïļ Image options and parameters of transform
method
transform
method uses transformation matrix to rotate, translate, and/or scale the image.
User needs to pass on the matrix that will be applied to the image. Matrix must have either 2 rows and 3 columns or 3 rows and 3 columns:
If 2x3 matrix is passed, the algorithm will consider it as affine transformation so last row will be set as [0,0,1]
;
- the first
a
ande
are responsible for image scaling b
andd
are responsible for shear. Combination of these 4 variables allows rotating.c
andf
are responsible for image translation.g
andh
are used for an operation called projection. It allows changing image perspective.i
is a normalization factor. It acts like a "scaling factor" for the entire coordinate system. Think of it as a zoom lens setting.
For more information take a look at the tutorial about image transformations
transform()
function can accept 2x3 as well as 3x3 matrix. If matrix's size is 2x3 that it becomes an affine transformation. This means that transformation happens on the same
Matrix cannot be singular. Otherwise it cannot be inverted. Click here to learn more.


Kinds of images compatible with algorithmâ
Image property | What it means | Possible values |
---|---|---|
bitDepth | number of bits per channel | [8,16] |
components | number of components | any |
alpha | is alpha channel allowed | true |
Parameters and its default valuesâ
-
transformMatrix
-
options
Optionsâ
Property | Required | Default value |
---|---|---|
borderType | no | constant |
borderValue | no | 0 |
fullImage | no | - |
height | no | - |
interpolationType | no | bilinear |
inverse | no | - |
width | no | - |