Skip to content

EXIF Orientation metadata option does not affect when drawing image on canvas. #1670

@cherevichka

Description

@cherevichka

If the JPEG image has orientation metadata, the drawImage method draws an unrotated image.

Steps to Reproduce

  1. Download JPG image with orientation metadata:
    red-line-rotated

  2. Load the image with loadImage utility.

  3. Draw the image on canvas.

const image = await loadImage("image_path");
const canvas = createCanvas(image.width, image.height);
const context = canvas.getContext("2d");

context.drawImage(image, 0, 0);

const result = canvas.toBuffer();

fs.writeFileSync("result_path", result);

Expected:
github1

Got:
github2

Tested on MacOS, CentoOS.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions