Image guidesPractical guides

A phone photo turns sideways in another app: normalize EXIF orientation before delivery

Decode the original using its EXIF orientation, then re-encode the oriented pixels to produce a sharing copy that no longer depends on that original tag. Deleting the tag or rotating a webpage preview alone does not establish that result. A downloadable four-quadrant JPEG separates orientation, pixel dimensions and privacy review.

A hand holding a silver compact camera, illustrating photo orientation
Illustrative photo: Peng Originals · Unsplash LicenseIllustrative photograph. The measured input is the downloadable four-quadrant specimen, not this camera photo.

The practical answer

The teaching original stores 240×160 pixels with Orientation 6. Applying its 90-degree clockwise orientation gives a 160×240 reference: green C and red A on top, yellow D and blue B below. Accept both dimensions and positions for this specimen; it is not a certification of every browser, photograph or metadata field.

Identify the display transform before changing pixels

A JPEG can contain a pixel array and an orientation instruction. One application may apply that instruction while a later processing stage reads the encoded array differently. Before rotating repeatedly, establish which file is the original and which copy you need to deliver.

The MDN createImageBitmap documentation describes the default from-image orientation handling. KitNelo’s metadata cleaner uses that decoding path before drawing and exporting a new canvas. This is implementation evidence, not a substitute for inspecting your download.

Three actions require different checks
ActionWhat changesDelivery check
Rotate a webpage previewThe current displayDo not infer that the downloaded file changed
Remove the original orientation tag aloneA display instruction disappearsThe original landscape pixel array may remain
Decode correctly and re-encodeThe new pixel arrangement and dimensionsReopen the file and inspect its labels

Reproduce the issue with one original and two controls

The exercise pack contains original colored blocks and letters, not client photographs. Keep orientation-6-original.jpg, tag-removed-without-pixel-rotation.jpg and normalized-reference.jpg as separate files rather than overwriting one path.

The encoded original has red A and blue B on its top row, green C and yellow D below, plus Orientation 6. The tag-only control remains 240×160 because its pixels were not rotated. The normalized reference is 160×240.

The CSS image-orientation reference distinguishes EXIF-based display correction from an additional CSS transform. A webpage showing a portrait image therefore does not establish that the underlying pixel array has become portrait.

Use quadrant color and letter identity to identify positions; rotating the entire pixel array also rotates the glyphs. A real photograph’s EXIF instruction can itself be wrong. A person must confirm the intended subject orientation rather than treating tag-based processing as proof that every photograph is correct.

One input, two delivery outcomes

Source

Encoded 240×160; Orientation 6; encoded rows A/B and C/D.

Reference conditions

Normalized 160×240; new rows C/A and D/B.

A 90-degree rotation exchanges width and height while keeping 240×160=160×240=38400 pixels. File size or pixel count alone cannot establish correct orientation.

Process one specimen before expanding the batch

Open the image metadata cleaner and select only orientation-6-original.jpg. Check the filename: the deliberately broken tag-only control no longer supplies the same orientation instruction.

Choose Remove metadata, wait for a generated result and use its Download button. The output name includes -clean, keeping it distinct from the original. A processing click or a download-started notice is not a completed file review.

  1. Check that the result reports 160×240 pixels.
  2. Open the actual browser download and inspect green C/red A at the top and yellow D/blue B below.
  3. Reopen the new file in another image-capable application and compare the same landmarks.
  4. Try a nonsensitive specimen in the intended receiving platform; it may apply its own resizing, cropping or encoding.

Keep dimensions, landmarks and file identity in the same ledger

The exercise answer is a set of conditions, not merely “the image opens.” Compare the reference’s orientation and labels. JPEG re-encoding can change bytes and edge colors; identical SHA-256 values or perfect pixel equality are not required between separate encoders.

Acceptance conditions for this specimen
CheckExpected observationIf it fails
Output dimensions160×240240×160 suggests the control input or an unbaked orientation
Top-left and top-rightGreen C and red AA/B calls for an input-version check
Bottom-left and bottom-rightYellow D and blue BReversed sides suggest a separate mirror operation
Pixel count38400Resizing is a different operation
ReopeningThe same appearance without the original tag dependencyKeep the original and investigate the receiving stage

Return to the last input whose transformation you can explain

If the 240×160 control has already lost its orientation instruction, the cleaner cannot infer which way a person should face. Prefer the preserved tagged original. If only a broken copy remains, establish the intended orientation manually before applying one explicit pixel rotation.

Reversed text may indicate mirroring rather than rotation. Use the text-and-landmark mirror versus rotation exercise to diagnose those operations separately.

Pause batch processing when

  • Corner labels do not match or the original file cannot be identified.
  • Applications still disagree and the input tag versus receiving transform is unresolved.
  • The job needs animation, RAW or a particular color workflow; this cleaner supports static JPG, PNG and WebP.

Orientation acceptance is one part of the sharing review

Normalization addresses the orientation dependency. Re-encoding may increase file size and JPEG export is not lossless. It does not erase visible addresses, faces, document contents or QR codes.

Use the EXIF and GPS sharing review for the final file and visible scene. Keep the original, a correctly oriented reference and the delivered copy identifiable. That is easier to recover than repeatedly overwriting final.jpg.

Further reading & sources

Put the guide into practice

Open the relevant tool, preview the result and check your exported file.

Related articles