ktx_extract(1)
ktx_extract(1) β KTX Tools Reference π
okay so bestie, welcome to the ktx_extract(1) glow-up page from the KTX Tools Reference. This command is literally here to extract selected images from a KTX2 file, and weβre gonna cover every flag, path, status code, and tiny detail. no cap. πβ¨
πΈ NAME πΈ
ktx_extract β ktx extract
Extract selected images from a KTX2 file. π¦
β¨ SYNOPSIS β¨
ktx extract [option...] input-file output-path
π DESCRIPTION π
okay so ktx extract can pull one image or multiple images out of the KTX2 file you pass as input-file, and depending on the format it saves them as Raw, EXR, or PNG image files to output-path. If input-file is '-', the file is read from stdin. If output-path is '-', the output file is written to stdout. And if the input file is invalid? The first validation error it encounters gets displayed to stderr, and the command exits with the relevant non-zero status code. periodt. π
output-path is interpreted as an output filepath for a single extract and as an output directory for multi-image extracts. When youβre extracting multiple images with either --all or any of the all args, each output file gets named like this:
output-path/output_level{}_face{}_layer{}_depth{}.extension
- the
_level{}part is only there if the source texture has more than 1 level - the
_face{}part is only there if the source texture is a cubemap or cubemap array (Cubemap) - the
_layer{}part is only there if the source texture is an array texture (Array) - the
_depth{}part is only there if the source textureβsbaseDepthis more than 1 (3D) - the
{}gets replaced with the numeric index of that component, starting from 0 - the
extensionpart is"raw","png", or"exr"based on the export format
Note: the inclusion of the optional parts is determined by the source texture, regardless of which images are requested. π
For non-raw exports, the output image format is chosen to be the smallest related lossless format:
_UNORMformats exported as PNG with RGB/RGBA 8/16 bit_SINT/_UINTformats exported as EXR with R/RG/RGB/RGBA Half/Float/UInt_SFLOAT/_UFLOATformats exported as EXR with R/RG/RGB/RGBA Half/Float/UIntD16_UNORMexported as PNG with luminance (Gray) 16 bit- Other Depth/Stencil formats exported as EXR with D/S/DS Half/Float
π₯ OPTIONS π₯
The following options are available:
--transcode <target>β Transcode the texture to target format before running the extract. This requires the input file to be transcodable β it must be either BasisLZ supercompressed or have a UASTC color model in the DFD. This option matches the functionality of thektx transcodecommand. If the target option is not set, ther8,rg8,rgb8, orrgba8target is selected based on the number of channels in the input texture. Block compressed transcode targets can only be saved in raw format. Itβs case-insensitive. Possible options are:etc-rgb|etc-rgba|eac-r11|eac-rg11|bc1|bc3|bc4|bc5|bc7|astc|r8|rg8|rgb8|rgba8.etc-rgbis ETC1;etc-rgba,eac-r11, andeac-rg11are ETC2. π--uri <uri>β KTX Fragment URI.https://registry.khronos.org/KTX/specs/2.0/ktx-frag.html--level [0-9]+ | allβ Level to extract. Whenallis used, every level is exported. Defaults to0. β¨--layer [0-9]+ | allβ Layer to extract. Whenallis used, every layer is exported. Defaults to0. β¨--face [0-9]+ | allβ Face to extract. Whenallis used, every face is exported. Defaults to0. β¨--depth [0-9]+ | allβ Depth slice to extract. Whenallis used, every depth is exported. Defaults to0. β¨--allβ Extract every image slice from the texture. π--rawβ Extract the raw image data without any conversion. π«Ά-h,--helpβ Print this usage message and exit. πΈ-v,--versionβ Print the version number of this program and exit. πΈ
π EXIT STATUS π
0β Success1β Command line error2β IO failure3β Invalid input file4β Runtime or library error5β Not supported state or operation6β Requested feature is not yet implemented
π HISTORY π
Version 4.0
- Initial version
π AUTHOR π
- MΓ‘tyΓ‘s CsΓ‘szΓ‘r [Vader], RasterGrid www.rastergrid.com
- Daniel RΓ‘kos, RasterGrid www.rastergrid.com
okay thatβs the whole manual, bestie β Version 0.0.0, Tue Jan 1 1980 00:00:00, ktx_extract(1). mwah, slay, bye. π
ππ
π¦ 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