canvas icon indicating copy to clipboard operation
canvas copied to clipboard

EXIF orientation is ignored?

Open nrkn opened this issue 3 years ago • 0 comments

When I draw an image with orientation set in the EXIF, it comes out sideways, eg ignores the EXIF - using canvas in the browser works fine in both Chrome and Firefox

In the meantime, I will parse the EXIF on image uploads myself and correct it that way, but just thought I'd let you know!

  const buffer = await readFile( 'IMG_6716.JPG' )

  const image = new Image()

  image.src = buffer

  const canvas = createCanvas( image.naturalWidth, image.naturalHeight )
  const context = canvas.getContext( '2d' )

  context.drawImage( image, 0, 0 )

  const out = canvas.toBuffer('image/png')

  await writeFile( 'IMG_6716.PNG', out )

Here is the image:

IMG_6716

nrkn avatar Feb 04 '22 06:02 nrkn