-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
export your map of filetype outputs #2642
Comments
Hi, it's possible to get close to this using the existing sharp.format runtime property, e.g. to filter for formats that support Stream-based output you might use: Object.values(sharp.format)
.filter(({ output }) => output.stream)
.map(({ id } => id) [ 'jpeg', 'png', 'webp', 'tiff', 'dz', 'heif', 'raw' ] However this currently deals with containers rather than codecs, e.g the newer AVIF and HEIC codecs both use a heif container. Perhaps this runtime property should additionally include a list of the possible codecs and file extensions for each format? |
And what limitations are there to exporting this I'm not affiliated with that Parcel; I just find the need to copy part of your source for this library odd. |
Hi, i just landed here for the same reason.
that would be perfect. |
Commit 905518f exposes the It also adds The values of Object.values(sharp.format)
.filter(f => f.output.stream) // only care about formats that support stream-based output
.map(f => [f.id, f.output.alias].flat()) // concatenate format id and its aliases
.flat()
.filter(Boolean) // remove any undefined entries after flattening The original request was to allow parcel to remove its own copy of an internal sharp data structure. Looking again at the parcel source, I think it could be simplified to call - imagePipeline[FORMATS.get(format)]({
+ imagePipeline.toFormat(format, { |
v0.31.0 now available with this improvement, thank you for the suggestion/feedback. |
What are you trying to achieve?
Allow consumers of sharp to use your supported types. Maybe this applies to supported inputs too.
Have you searched for similar feature requests? yes
What would you expect the API to look like?
export formats
What alternatives have you considered?
No.
Is there a sample image that helps explain?
Here in Parcel's code they're copying your types, but like, they should be able to import this so they don't have to maintain parity
https://github.com/parcel-bundler/parcel/blob/0934f9f/packages/transformers/image/src/ImageTransformer.js#L5
The text was updated successfully, but these errors were encountered: