-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
Can textureResize become textureCompress on the web? #801
Comments
I'm not using very much of the Sharp API, I wonder if we could 'polyfill' Sharp with a small wrapper around glTF-Transform/packages/functions/src/texture-compress.ts Lines 132 to 147 in 482a718
An alternative here would be https://github.com/kleisauke/wasm-vips ... same underlying native library as Sharp, compiled to WASM, but note the "early development" disclaimers. I tend to assume the compression with libvips is better than what browsers provide, but I don't really know on that. |
Yes, I guess I thought most of the code for that polyfill was already in |
Maybe just removing |
Is your feature request related to a problem? Please describe.
I'd like to compress jpg/png textures into webP on the web.
textureCompress
is the function I want, but it doesn't (yet) work on the web.textureResize
does work on the web, but only supports jpg/png and apparently not converting between them.Describe the solution you'd like
Looking at your
ndarray-pixels
package, it seems liketextureResize
would be able to do everythingtextureCompress
does if this check were removed (at least on web) and the options were added. Is there any reason not to?Describe alternatives you've considered
Wait for
sharp
to add web support.Additional context
I'd like to take a stab at making a very simple, very automatic glTF optimizer based on
gltf-transform
, probably living next to the model-viewer editor.The text was updated successfully, but these errors were encountered: