Skip to content

Cropping image with EXIF orientation > 1 fails #16347

@robinvangestel21

Description

@robinvangestel21

Describe the Bug

When uploading images that have an EXIF orientation greater than 1, Payload appears to normalize orientation on upload, but crop operations still fail. This seems related to the fix for upload orientation:

In my reproduction, cropping EXIF-rotated images causes one of two outcomes:

  1. Crop saves, but the resulting image is rotated/flipped incorrectly
  2. Crop cannot be saved and throws ERROR: extract_area: bad extract area.

Expected behavior
Cropping EXIF-rotated images should succeed and preserve the correct visual orientation in the saved output.

Actual behavior
Cropping either:

  • produces incorrectly oriented output, or
  • fails with extract_area: bad extract area

Link to the code that reproduces this issue

https://github.com/robinvangestel21/payload-crop-rotate-reproduction

Reproduction Steps

  1. Clone the reproduction repo
  2. Install dependencies and run the app
  3. Open the media library and open an image with EXIF orientation > 1 (example images from: https://github.com/recurser/exif-orientation-examples)

Scenario 1: crop saves but output is wrongly rotated/flipped

  1. Use Landscape_2.jpg
  2. Crop the image by subtracting 1px from the width and 1px from the height.
  3. Save
  4. Observe saved media: orientation is incorrect (flipped/rotated).
Image

Scenario 2: crop fails to save

  1. Use Landscape_8.jpg
  2. Crop the image by subtracting 1px from the width and 1px from the height.
  3. Save
  4. Observe terminal error: ERROR: extract_area: bad extract area.

Which area(s) are affected?

area: core

Environment Info

Binaries:
  Node: 24.14.1
  npm: 11.11.0
  Yarn: 1.22.22
  pnpm: 10.32.1
Relevant Packages:
  payload: 3.83.0
  next: 16.2.3
  @payloadcms/db-mongodb: 3.83.0
  @payloadcms/graphql: 3.83.0
  @payloadcms/next/utilities: 3.83.0
  @payloadcms/richtext-lexical: 3.83.0
  @payloadcms/translations: 3.83.0
  @payloadcms/ui/shared: 3.83.0
  react: 19.2.4
  react-dom: 19.2.4
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:54:46 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T6000
  Available memory (MB): 32768
  Available CPU cores: 8

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreCore Payload functionalitystatus: needs-triagePossible bug which hasn't been reproduced yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions