Skip to content

How does PNG transform into KTX2 #559

Answered by MarkCallow
baiwenbo1997 asked this question in Q&A
Discussion options

You must be logged in to vote

@baiwenbo1997 the ktxTexture2_Write* functions write a ktxTexture2 object in memory to a file. That is they serialize existing KTX2 data. They do not do any conversion. Use toktx to create KTX2 files from PNG files. If you want to write your own software to do this, also look at toktx to see how to do it. The steps for a color texture are (some steps are different if handling normal maps)

  1. Read PNG header
  2. Select matching Vulkan format
  3. Create ktxTexture2 object with that format
  4. Read PNG data expanding bit-width if necessary
  5. Add data to base level of the ktxTexture2 object
  6. Generate mip levels or read an additional file per level, if desired, and add to ktxTexture2 object.
  7. Write the ktxTextu…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
6 replies
@MarkCallow
Comment options

@baiwenbo1997
Comment options

@MarkCallow
Comment options

@baiwenbo1997
Comment options

@MarkCallow
Comment options

Answer selected by MarkCallow
Comment options

You must be logged in to vote
1 reply
@MarkCallow
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants