Skip to content

Windows: MediaPickerOptions.RotateImage applies EXIF orientation twiceΒ #38570

Closed

Description

@formerlymisterhenson

(AI assisted description)

Description

When using MediaPickerOptions.RotateImage = true on Windows, images appear to have their EXIF orientation applied twice.

The issue is reproducible with images whose pixel data is physically unrotated (0Β°) and where only the EXIF orientation flag differs.

Reproduction Matrix

Physical Pixels EXIF Orientation Result after RotateImage=true
0Β° 0Β° 0Β°
0Β° 90Β° (EXIF=6) 180Β°
0Β° 180Β° (EXIF=3) 0Β°
0Β° 270Β° (EXIF=8) 180Β°

Expected Results

Physical Pixels EXIF Orientation Expected Result
0Β° 0Β° 0Β°
0Β° 90Β° 90Β°
0Β° 180Β° 180Β°
0Β° 270Β° 270Β°

Environment

  • .NET MAUI 10
  • Windows
  • MediaPickerOptions.RotateImage = true

Suspected Location

src/Essentials/src/MediaPicker/ImageProcessor.windows.cs

Relevant code:

var orientation = await GetImageOrientation(decoder);

encoder.BitmapTransform.Rotation = orientation;

var pixelData = await decoder.GetPixelDataAsync(--> which defaults are used here?);

encoder.SetPixelData(
    decoder.BitmapPixelFormat,
    decoder.BitmapAlphaMode,
    decoder.OrientedPixelWidth,
    decoder.OrientedPixelHeight,
    decoder.DpiX,
    decoder.DpiY,
    pixelData.DetachPixelData());

Analysis

The observed behavior suggests that orientation is being applied twice.

The output follows the pattern:

0Β°   -> 0Β°
90Β°  -> 180Β°
180Β° -> 360Β° (appears as 0Β°)
270Β° -> 540Β° (appears as 180Β°)

which is equivalent to:

result = orientation * 2 (mod 360)

This strongly suggests that the EXIF-derived orientation is being applied twice during processing.

Possible areas to investigate:

  • decoder.GetPixelDataAsync()
  • decoder.OrientedPixelWidth / decoder.OrientedPixelHeight
  • encoder.BitmapTransform.Rotation

The interaction between these APIs may already produce orientation-aware pixel data while BitmapTransform.Rotation applies the same orientation again.

Additional Notes

This does not appear to be an EXIF cleanup issue.

The resulting file no longer contains the original EXIF orientation information, but the pixel data itself is already rotated incorrectly.

The issue seems to occur during the Windows image processing pipeline rather than during metadata preservation/removal.

I can reproduce this reliably using the same image with only the EXIF orientation value changed (0Β°, 90Β°, 180Β°, 270Β°).

Activity

  1. HarishKumarSF4517 commented on Sep 16, 2026

    @HarishKumarSF4517
    Contributor

    This issue has been validated in Visual Studio Insiders 12120.281with .NET MAUI versions 10.0.100 and 10.0.101. It can be reproduced on Windows platform.

    Screen.Recording.2026-09-16.153737.mp4
  2. added a commit that references this issue on Sep 16, 2026
    a184eb2
  3. added this to the .NET 10 SR12 milestone on Sep 16, 2026
  4. added 8 commits that reference this issue on Sep 18, 2026
    a692e82
    92007ea
    75e0382
    7b6501a
    88d9e9c
    6053352
    46a8a61
    0441b13
  5. kubaflo commented on Oct 10, 2026

    @kubaflo
    Contributor

    Thank you for the report and the investigation details. We are closing this as completed: Windows MediaPicker no longer applies encoder rotation after decoding has already applied EXIF orientation, preventing the reported double rotation. The reporter confirmed the fix works.

    Supporting evidence: #38591 (merged into inflight/current).

    This records the merged source change; it does not imply that the fix is present in every released .NET MAUI package.

    If you can still reproduce the reported behavior in a build that includes the linked change, please comment here with the exact version and reproduction details so we can reopen and investigate. The existing reproduction and discussion remain available; a new issue is not required.

  6. added 6 commits that reference this issue on Oct 13, 2026
    810baa9
    e17413f
    1f7a0f5
    542926a
    85a69e6
    a8710ed
  7. locked and limited conversation to collaborators on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions