ktx_compare(1)
π ktx_compare(1) β the KTX Tools Reference glow-up
okay so bestie, gather round, because this is the manual page for ktx_compare from the KTX Tools Reference and it's genuinely so useful. π
β¨ NAME β¨
ktx_compare β ktx compare. literally just: compare two KTX2 files. that's the whole vibe. π¦
πΈ SYNOPSIS πΈ
ktx compare [option...] input-file1 input-file2
π DESCRIPTION π
ktx compare compares the two KTX2 files you pass as the input-file1 and input-file2 arguments and outputs any mismatch in texture information and/or image data. no cap, it catches everything.
the command implicitly calls validate and prints any found errors and warnings to stdout. and listen β if any of the specified input files are invalid, then the comparison is done on a best effort basis and may be incomplete. so like, it tries its best, but don't come for it. π
the JSON output formats conform to the https://schema.khronos.org/ktx/compare_v0.json schema even if the input file is invalid and certain information cannot be parsed or displayed. also! for JSON outputs the KTX file identifier is printed using "\u001A" instead of "\x1A", because an unescaped "\x1A" sequence inside a JSON string breaks nearly every JSON tool. rude of it honestly. note that this does not change the value of the string, only its representation. π
π«Ά Note
ktx compare prints using UTF-8 encoding. if your console is not set for UTF-8 you will see incorrect characters in output of the file identifier on each side of the "KTX nn". not the console's best moment tbh π
β OPTIONS β
The following options are available:
--format text | json | mini-jsonβ specifies the report output format. possible options are:textβ Human readable text based format.jsonβ Formatted JSON.mini-jsonβ Minified JSON.
The default format is text.
--content raw | image | ignoreβ controls how image content is compared. possible options are:rawβ Encoded image data is compared verbatim, as it appears in the file.imageβ Effective image data is compared per texel block.ignoreβ Ignore image contents.
The default mode is raw, meaning that the encoded image data must match exactly.
Note: when the mode is set to image, the effective image data of individual mip levels, layers, and faces is compared texel block by texel block after applying one or more of the following transformations, if needed:
- If the texture is supercompressed (e.g. using Zstandard or ZLIB), the images are deflated before comparison.
- If the texture is encoded using BasisLZ, the images are transcoded to
R8G8B8A_UNORMbefore comparison.
For block compressed textures and textures encoded using UASTC the texel blocks are the individual compressed blocks, while for other formats the texel blocks are the individual pixels of the image.
When comparing files that use different supercompression schemes, or otherwise different encoding, additional options may need to be used to avoid unexpected differences being reported related to the meta information of the files. for example:
- The supercompression scheme can be ignored with
--ignore-supercomp. - Compressed byte length and other index section differences can be ignored with
--ignore-index allor--ignore-index level. - DFD section differences can be ignored with
--ignore-dfd allor--ignore-dfd all-except-color-space. - BDFD bytesPlane value differences can be ignored with
--ignore-bdfd-bytesplane. - SGD section differences can be ignored with
--ignore-sgd allor--ignore-sgd payload.
--per-pixel-output all | <number> | noneβ controls whether per pixel / texel block difference output is generated when--contentis set toimage:allβ Every single difference is output (may result in a very large output). like, huge. be warned π<number>β At most the specified number of differences are output.noneβ No per pixel / texel block differences are output.
The default mode is none to limit the verbosity of the output.
--allow-invalid-inputβ perform best effort comparison even if any of the input files are invalid.--ignore-format-headerβ ignore thevkFormatandtypeSizefields in the file header.
Note: useful when comparing textures with and without BasisLZ encoding, respectively.
--ignore-supercompβ ignore supercompression scheme in the file header.
Note: use the --ignore-sgd option to also ignore the SGD section, if needed.
--ignore-index all | level | noneβ controls the comparison of index entries in the file headers. possible options are:allβ Ignore all index entries.levelβ Ignore level index entries only.noneβ Do not ignore any index entries.
The default mode is none, meaning that all index entries will be compared.
--ignore-dfd all | all-except-color-space | unknown | extended | noneβ controls the comparison of DFD blocks. possible options are:allβ Ignore all DFD blocks.all-except-color-spaceβ Ignore all DFD blocks except the color space information in the basic DFD block.unknownβ Ignore any unrecognized DFD blocks.extendedβ Ignore all DFD blocks except the basic DFD block.noneβ Do not ignore any DFD blocks.
The default mode is none, meaning that all DFD entries will be compared.
--ignore-bdfd-bytesplaneβ ignore BDFDbytesPlanevalues. useful when comparing pre-spec-2.0.4 supercompressed files with 2.0.4+ supercompressed or non-supercompressed ones, asbytesPlaneis set to zero in older supercompressed files. (older files really said "bytesPlane? never heard of her") π--ignore-metadata all | <key>[,...] | noneβ controls the comparison of metadata (KVD) entries. possible options are:allβ Ignore all metadata entries.<key>[,...]β Ignore the specified comma separated list of metadata keys.noneβ Do not ignore any metadata entries.
The default mode is none, meaning that all metadata entries will be compared.
--ignore-sgd all | unknown | payload | noneβ controls the comparison of the SGD section. possible options are:allβ Ignore the SGD section.unknownβ Ignore any unrecognized SGD section.payloadβ Ignore any unrecognized SGD section and the payload of any known SGD section.noneβ Do not ignore the SGD section.
The default mode is none, meaning that SGD sections will always be compared.
Note: --ignore-sgd payload can be used to compare BasisLZ SGD headers without expecting an exact match for the individual SGD payload sections.
-h,--helpβ print this usage message and exit. π«Ά-v,--versionβ print the version number of this program and exit.
π note β reports about image content mismatches when--contentis set toraworimageinclude the following information: - The level, layer, and face index of the image where the difference was found.
π note β reports about individual texel block differences when--contentis set toimageinclude the following additional information: - The texel coordinates within the image where the difference was found. These coordinates are the raw coordinates of the image and are not affected by metadata such asKTXorientation. - The packed elements of the texel block output as an array of hexadecimal values. Each packed element has a byte size equal to thetypeSizevalue of the image. - The channel values of the texel block output as an array of integer (for integer and normalized formats) or floating point (for floating point formats) values. In case of floating point formatsNaN,+inf, and-infare used to indicate values that are not a number or represent infinities, respectively. The output order of the channels always follow the order they appear in the BDFD.
π EXIT STATUS π
0β Success π1β Command line error2β IO failure3β Invalid input file4β Runtime or library error5β Not supported state or operation6β Requested feature is not yet implemented7β Input files are different π (the whole point of the tool, honestly)
π¦ HISTORY π¦
- Version 4.0
- Initial version β everyone's gotta start somewhere β¨
π AUTHOR π
- Daniel RΓ‘kos, RasterGrid www.rastergrid.com
and that's the whole page, bestie! this one's from Version 0.0.0, dated Tue Jan 1 1980 00:00:00 β iconic timestamp, love that for it π go forth and compare your KTX2 files, you absolute main character π
π¦ where this page comes from
- nixos 26.05: ktx-tools 4.4.2
- nixpkgs unstable: ktx-tools 4.4.2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms