vite-plugin-image-optimizer
vite-plugin-image-optimizer copied to clipboard
Convert to different image formats
Describe the feature you'd like to request
It would be really great if you could convert an image into a different image formats for production
for example converting a png image into another format available in sharp like webp/avif/etc...
I think this would be great to save people the time when doing the conversion, and to save some additional space.
Describe the solution you'd like
maybe a toFormat option in the config file since that is the name of the method in the sharp package. Where you can specify as a string what format you would like to image to be converted to.
Additional context
https://sharp.pixelplumbing.com/api-output#toformat
Thank You!
Validations
- [X] Read the docs.
- [X] Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.
Hey @VictorCam thank you for the suggestion, this is being looked at the PR raised by @netolicak. You can follow the progress https://github.com/FatehAK/vite-plugin-image-optimizer/pull/23
Sound good. Thank you!
An extremely necessary option.
I need that)
It could be awesome if the plugin generates various outputs and automatically choose the best file at runtime based on file size and format.
- The plugin could generate automatically avif, webp, png and jpg (only if the pictures don't contains alpha channel)
- We remove useless file based on sizes and original file size (example: it's useless to keep a webp file if the png file is smaller / it's useless to keep "optimized" file if the original one is smaller)
- At runtime, we test the Avif and webp compatibility, based on these tests, we resolve the smallest file
Lighthouse keeps on complaining and wanting me to use webp. I am not sure if every browser supports webp but it seems most do? I am trying to figure out how to use this plugin along with others to make webp. Any chance this issue is being worked on still? Thanks