-
-
Notifications
You must be signed in to change notification settings - Fork 153
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
Expose functionality to compress individual textures #1162
Comments
For other formats (PNG, JPG, WEBP, AVIF) you can use the Also see: This would be easier if an suitable npm library existed for KTX2 compression, as it is, I need logic to create temporary scratch directories and so on, which would also need to be handled per-texture here. I probably will not spend time on this myself unless/until #675 gets unblocked, but I'd be happy to review a PR if someone would like to try splitting |
I see, thanks for pointing that out. I am exploring this area now. I'll report back if I discover anything useful |
@krispya If it can help the technique I currently use is to save the image data to a file of the texture i want to save, call the ktx cli tools to convert and then push it back to gltftransform. |
I've doing something similar (using a temporary file on disk and processing it via the ktx CLI) for ktx2 decompression (from image texture file embedded within the glb). For ktx2 compression would it be possible to enclose these 2 glTF-Transform/packages/cli/src/cli.ts Lines 411 to 435 in 0bf0ecb
|
@jo-chemla I'm not sure I want to maintain those two calls wrapped as a scripting API for upstream applications. It's common that you'd want to make different choices about which texture slots are UASTC vs. ETC1S, or the settings for each, there's nothing magic about my choices here. I'd be happy to review a PR making the changes described by #1162 (comment), though. Or maybe two separate functions are needed, like |
When creating an asset pipeline there are often situations where I need to transform data, such as compressing individual textures, without it being embedded in a gltf or glb. Instead of cherry picking these functions out of gltf-transform, it would be great if were exported. For example, being able to compress any texture to KTX2 via a node call.
The text was updated successfully, but these errors were encountered: