Open ascorbic opened 2 years ago
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.
The global option does seem like a good idea
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?
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,
}
});
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?
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 allowedrotate
to be called without an angle, or if auto-rotation was the default (which would be my suggestion)