Skip to content

[Wasm] Incorrect aspect ratio for images with EXIF orientation metadata #3388

@luca-campara

Description

@luca-campara

Describe the bug
I found an issue in how Coil handles EXIF orientation metadata on the Wasm target when loading with AsyncImage.
Portrait images taken on iPhones are displayed distorted/stretched, while they work correctly on all other KMP targets. The EXIF orientation metadata of those images is 6 (Rotated 90° CCW).
It appears that Coil is attempting to fit the vertical pixel buffer into horizontal dimensions (or vice versa) without correctly applying the EXIF transformation on the Wasm target.

Validation
I have verified that this is a Coil-specific issue:

  • When loading the same image using the standard Compose Multiplatform Image component with painterResource, it renders correctly.
  • The distortion only occurs when the image is processed via Coil on Wasm.

To Reproduce
I have provided a minimal reproducible project with a sample "rotated" image here:: https://github.com/luca-campara/TestCoilWasm

Version

  • Coil version 3.4.0
  • Kotlin version 2.3.20
  • CMP version 1.10.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions