Image Affine Transform
Apply a custom 2x2 affine matrix to an image to scale, shear, mirror or rotate it in one step. Enter the coefficients a, b, c and d, optional output offsets, an interpolation method and a background color for the uncovered area. The tool computes the new canvas from the transformed corners. It suits developers, designers and students who want exact control over linear image transforms.
Frequently asked questions
What is an affine transform?
An affine transform maps every pixel position (x, y) to a new position (a times x plus b times y, c times x plus d times y). It can scale, shear, mirror and rotate an image while keeping straight lines straight and parallel lines parallel.
What do the four matrix values mean?
The values a and d scale the image horizontally and vertically, and b and c shear it. The identity matrix a=1, b=0, c=0, d=1 leaves the image unchanged. Each value accepts -10 to 10, including decimals.
How do I rotate with a matrix?
For a rotation by an angle, use a = cos, b = -sin, c = sin and d = cos of that angle. For 30 degrees that is a=0.866, b=-0.5, c=0.5, d=0.866. The canvas grows to hold the rotated corners.
How do I mirror an image?
Set a to -1 to mirror horizontally or d to -1 to mirror vertically, keeping the other values at the identity. Setting both to -1 turns the image upside down, which is the same as a 180 degree rotation.
What do the output offsets do?
The offsets shift the transformed image inside the output canvas by up to 1000 pixels in each direction. The canvas size stays the same, so a shifted image is cut off on one side and gains background on the other.
Which interpolation should I choose?
Bicubic is a good default for photos. Nearest neighbor keeps hard pixel edges for pixel art and screenshots, bilinear is softer, and locally bounded bicubic, Nohalo and VSQBS reduce halos when enlarging. The choice only matters where pixels land between grid positions.
Why is my matrix rejected?
A matrix whose determinant, a times d minus b times c, is close to zero squashes the image into a line, so the tool refuses it. Results wider or taller than 6000 pixels are also refused; reduce the scale values to stay inside that bound.
What fills the area outside the image?
Transforms that shear or rotate leave empty corners on the new canvas. They are transparent by default and saved in a PNG with an alpha channel. Enter a hex color such as #000000 to fill them instead.
Which file formats can I upload?
JPEG, PNG, GIF, WebP, TIFF and AVIF images up to 5 MB are supported. Animated files use their first frame. Images larger than 4000 pixels on a side are scaled to fit 4000 pixels before the transform.
How is this different from the skew tool?
The Image Skew tool builds a shear matrix from a single angle for you. This tool exposes all four coefficients, so you can combine scaling, shearing and mirroring in one pass and reproduce transforms from code or CSS matrix values.