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

Convert to different image formats #20

Open
2 tasks done
VictorCam opened this issue Jun 8, 2023 · 8 comments
Open
2 tasks done

Convert to different image formats #20

VictorCam opened this issue Jun 8, 2023 · 8 comments
Labels
enhancement New feature or request

Comments

@VictorCam
Copy link

VictorCam commented Jun 8, 2023

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

  • Read the docs.
  • Check that there isn't already an issue that requests the same feature to avoid creating a duplicate.
@VictorCam VictorCam added the enhancement New feature or request label Jun 8, 2023
netolicak added a commit to netolicak/vite-plugin-image-optimizer that referenced this issue Jul 14, 2023
@FatehAK
Copy link
Owner

FatehAK commented Jul 21, 2023

Hey @VictorCam thank you for the suggestion, this is being looked at the PR raised by @netolicak. You can follow the progress #23

@VictorCam
Copy link
Author

Sound good. Thank you!

@tuber84
Copy link

tuber84 commented Sep 21, 2023

An extremely necessary option.

@sergey-yarchuk-4ib
Copy link

I need that)

@Maxou44
Copy link

Maxou44 commented Mar 1, 2024

It could be awesome if the plugin generates various outputs and automatically choose the best file at runtime based on file size and format.

  1. The plugin could generate automatically avif, webp, png and jpg (only if the pictures don't contains alpha channel)
  2. 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)
  3. At runtime, we test the Avif and webp compatibility, based on these tests, we resolve the smallest file

@quetzalsly
Copy link

quetzalsly commented Oct 30, 2024

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

@aloayzab88
Copy link

Looking for this option too. Already using the plugin for SVG and gulp for webp bu It will be awesome to just use this to convert PNG to webp

@baticodes
Copy link

I was also looking for this. Nowadays is common to generate a picture with different image formats and this would be great to have.

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

No branches or pull requests

8 participants