If the JPEG image has orientation metadata, the drawImage method draws an unrotated image.
Steps to Reproduce
-
Download JPG image with orientation metadata:

-
Load the image with loadImage utility.
-
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:

Got:

Tested on MacOS, CentoOS.
Thanks!