jw-12138 / vite-plugin-vsharp

Compress Images for the Web with Vite and Sharp
MIT License
43 stars 0 forks source link

Preserve image metadata such as orientation #9

Closed prince-thind closed 1 year ago

prince-thind commented 1 year ago

In the default settings there is no way to specify the preservation of image meta data. Here's a stack overflow discussion highlighting the procedure to implement that in sharpjs. It's just annoying when the compressed images just randomly rotate and hence make this package unfit for many scenarios involving JPG images.

jw-12138 commented 1 year ago

hey man, i know it's a bit too late but now you can finally use the preserveMetadata option to preserve the orientation in vite-plugin-vsharp@1.5.4.

import {defineConfig} from 'vite'
import vsharp from 'vite-plugin-vsharp'

export default defineConfig({
  plugins: [
    vsharp({
      preserveMetadata: {
        orientation: true
      }
    })
  ]
})