Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotation based on EXIF information #3037

Closed
zdnk opened this issue Jan 10, 2022 · 3 comments
Closed

Rotation based on EXIF information #3037

zdnk opened this issue Jan 10, 2022 · 3 comments
Labels

Comments

@zdnk
Copy link

zdnk commented Jan 10, 2022

Hello,

I am trying to rotate the image and remove all the EXIF information. After running the following code:

await sharp(file)
            .rotate()
            .resize(1024, 1024, { fit: 'cover', withoutEnlargement: true })
            .jpeg({
                mozjpeg: true,
                quality: 80,
                progressive: true,
            })
            .toFile(newFile);

the image uploaded from iPhone is still rotated 90 degrees. According to documentation the call to .rotate() should auto-rotate the image and remove the EXIF info.

@zdnk zdnk added the question label Jan 10, 2022
@zdnk
Copy link
Author

zdnk commented Jan 10, 2022

running console.log(await sharp(file).metadata()) prints:

{
  format: 'png',
  width: 4032,
  height: 3024,
  space: 'srgb',
  channels: 3,
  depth: 'uchar',
  density: 72,
  isProgressive: false,
  hasProfile: true,
  hasAlpha: false,
  exif: <Buffer 4d 4d 00 2a 00 00 00 08 00 01 87 69 00 04 00 00 00 01 00 00 00 1a 00 00 00 00 00 02 a0 02 00 04 00 00 00 01 00 00 0f c0 a0 03 00 04 00 00 00 01 00 00 ... 6 more bytes>,
  icc: <Buffer 00 00 02 24 61 70 70 6c 04 00 00 00 6d 6e 74 72 52 47 42 20 58 59 5a 20 07 e1 00 07 00 07 00 0d 00 16 00 20 61 63 73 70 41 50 50 4c 00 00 00 00 41 50 ... 498 more bytes>
}

@zdnk
Copy link
Author

zdnk commented Jan 10, 2022

seems like to rotation or orientation is missing in the EXIF/meta info

@zdnk
Copy link
Author

zdnk commented Jan 10, 2022

it was my bad, i was uploading the image without EXIF data from the iOS app

@zdnk zdnk closed this as completed Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant