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

Support auto-rotation based on EXIF data #81

Open
ascorbic opened this issue Aug 9, 2022 · 5 comments
Open

Support auto-rotation based on EXIF data #81

ascorbic opened this issue Aug 9, 2022 · 5 comments

Comments

@ascorbic
Copy link
Contributor

ascorbic commented Aug 9, 2022

If sharp's rotate() function is called without arguments then it will try to automatically rotate the image based on exif data. ipx currently doesn't support this, and can only do explicit rotation. It would be good if it either allowed rotate to be called without an angle, or if auto-rotation was the default (which would be my suggestion)

@pi0
Copy link
Member

pi0 commented Aug 9, 2022

Seems a good idea. Sharp has a global useExifOrientation option. We had it in previous versions of IPX (See #13) which can add back support and possibly enable by default. However not sure what was reasons sharp kept it disabled by default.

@ascorbic
Copy link
Contributor Author

ascorbic commented Aug 9, 2022

The global option does seem like a good idea

@tmlmt
Copy link

tmlmt commented Mar 8, 2023

Hi both, I started using ipx / nuxt-image and have just stumbled upon this issue for images in portrait format that I've been using. Indeed, it seems that the useExifOrientation option (introduced 6 years ago in this commit of sharp) was set to false from the beginning. See commit text.

Any idea when this could be implemented in ipx?

@tmlmt
Copy link

tmlmt commented Oct 16, 2023

Turns out it works just by providing the useExifOrientation option to sharp.

For instance in my case in Nuxt with the image module, in nuxt.config.ts:

  image: {
    sharp: {
      useExifOrientation: true,
    },
  },

or for IPX only, with the Programatic API:

const ipx = createIPX({
    // ...
    sharpOptions: {
        useExifOrientation: true,
    }
});

@michaelmannucci
Copy link

Turns out it works just by providing the useExifOrientation option to sharp.

For instance in my case in Nuxt with the image module, in nuxt.config.ts:

  image: {
    sharp: {
      useExifOrientation: true,
    },
  },

or for IPX only, with the Programatic API:

const ipx = createIPX({
    // ...
    sharpOptions: {
        useExifOrientation: true,
    }
});

THat didn't seem to work for me. I'm using NextJS, does it make a difference?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants