Rotate or mirror an image: 90°, operation order and PNG output

Check rotation and horizontal-flip order with six colored pixels, and distinguish visible orientation, EXIF tags and static PNG export.

Content reviewed ·

The problem and context

A sideways phone photo, inverted scan or mirrored screenshot starts with the browser’s decoded view. EXIF orientation may affect display while the stored pixels follow another order. Exporting the rotated view as PNG writes that orientation into the output pixels rather than merely changing a tag.

Method and calculation

Each turn is 90°; four clockwise turns restore the starting orientation. A horizontal flip swaps the current view’s left and right, while a vertical flip swaps top and bottom. Rotation and reflection do not freely commute. Integer transforms exchange width and height at a quarter turn without adding rotational interpolation.

Worked example

Label a 3-by-2 image ABC / DEF. A clockwise turn gives DA / EB / FC, now 2-by-3. Flipping that visible result horizontally gives AD / BE / CF. Flipping the original first and then turning clockwise instead gives FC / EB / DA. Compare the original, preview and downloaded pixels in that order.

Checklist

PNG is a static bitmap. SVG is rasterized, animated formats use the default frame, and source EXIF metadata is not copied. Transparency can remain, while color decoding and semitransparent pixels depend on the browser. For Base 64 of the original bytes, use the image Base 64 converter without a rotation export.

Rotate and flip images

Upload image

Drop an image here. Choosing another file replaces the current image.

Browser-decodable images, including raster formats, SVG, AVIF and ICO. Up to 64 MiB, 16384 pixels per side and 32 million pixels total.

Images are processed locally. Output is a static PNG with transparency; original EXIF and other source metadata are not copied.

Use these tools with this article

  • Image Base64 Converter

    Encode PNG, JPEG, GIF, WebP and BMP, or restore the original image from Base64.

  • Image Compressor

    Resize images in your browser, export JPEG, PNG or WebP, compare actual file sizes and choose a JPEG background for transparent areas.

  • Image Rotate & Flip

    Rotate by 90° or flip the current view, compare it with the original, then download PNG.

Sources