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

ktx tools suite does not support WebP images #441

Open
juber-nunes opened this issue Jun 18, 2021 · 10 comments
Open

ktx tools suite does not support WebP images #441

juber-nunes opened this issue Jun 18, 2021 · 10 comments

Comments

@juber-nunes
Copy link

Love the tool, very handy for KTX conversions. The issue I'm facing is this, trying to convert the image below and getting unsupported input file.

Does anyone would know why?

Top-view-Closeup-blue-water-ringsYJ-1

@MarkCallow
Copy link
Collaborator

MarkCallow commented Jun 19, 2021

Despite the name it has been given in your comment, it appears to be a .webp image which are not supported by toktx. When compressing to Basis universal (or any GPU compressed texture format) it is strongly recommended to start from uncompressed images. WebP images are compressed.

@lexaknyazev
Copy link
Member

@MarkCallow
WebP has both lossy and lossless modes so we may consider adding it as a supported input format if there's enough demand.

@MarkCallow MarkCallow changed the title toktx: failed to create image from <img> Format of input file is unsupported toktx: does not support WebP images Feb 18, 2022
@alexkowel
Copy link

Indeed, having this option supported would be very useful. We develop Verge3D, a WebGL toolkit that among other things have strong integration with Blender. Blender just got support for WebP images and our users are asking whether they can use KTX texture compression for this very promising format.

@MarkCallow
Copy link
Collaborator

@alexkowel what do your users want to do with webp and what makes it "promising" for it?

Note that even if webp is used to deliver a texture to a device, it will be fully inflated on the GPU and thus save no memory. The advantages of using webp for source images for toktx, if any, depend on its usefulness in the rest of the content creation pipeline. Within toktx it will be inflated and the result used directly, if an uncompressed output format is selected, or re-encoded with BasisU or ASTC, if one of those output formats is selected. Therefore any improvements over, say, JPEG source images will be marginal.

@alexkowel
Copy link

@MarkCallow I agree that switching to WebP won't affect compressed images. The rationale behind my suggestion is as follows.

  1. Blender artists just want to use WebP because it's supported natively in Blender and have many advantages over PNG/JPG.
  2. We don't really want to force users to not use this format if they need KTX compression.
  3. If KTX compression were supported for WebP, the artists could just use this efficient format everywhere and select compression individually for each image at their discretion, e.g disable compression if any artifacts found.

@lexaknyazev
Copy link
Member

  • As of today, WebP is indeed the best non-GPU-compressed format for asset distribution. Not so much for DCC workflows due to limited tooling, although it's getting better.
  • Users that have encoded their textures to lossy WebP for transmission should not do another lossy conversion to KTX/BasisU. Instead, they should encode KTX/BasisU from lossless PNG (or very high-res JPEG).
  • On the other hand, encoding lossless WebP textures to KTX/BasisU is fine and therefore should not require any extra steps.

So, it's likely that KTX-Software will eventually support WebP.

@MarkCallow
Copy link
Collaborator

3. If KTX compression were supported for WebP,

What exactly do you mean? If you mean KTX files containing WebP compressed images, that isn't going to happen. KTX is for GPU ready formats.

@alexkowel
Copy link

alexkowel commented Oct 3, 2022

What exactly do you mean? If you mean KTX files containing WebP compressed images, that isn't going to happen. KTX is for GPU ready formats.

No-no, I just meant supporting WebP to KTX conversion in toktx utility.

@MarkCallow
Copy link
Collaborator

On the other hand, encoding lossless WebP textures to KTX/BasisU is fine and therefore should not require any extra steps.

When support is added how should we handle lossy WebP images? Should we warn or error? My opinion is warn.

@MarkCallow MarkCallow changed the title toktx: does not support WebP images ktx tools suite does not support WebP images Nov 29, 2023
@MarkCallow
Copy link
Collaborator

Changed title as the legacy tool toktx will not be updated but we may add this feature to the new ktx tool suite in future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants