# cmd/bunyip-tex

`import "github.com/matjam/bunyip/cmd/bunyip-tex"`

Command bunyip-tex compresses PNG and JPEG images into KTX2 texture files that asset.Texture and gfx.NewCompressedTexture upload straight to the GPU, with the whole mip chain built here rather than while a game runs.

Usage:

	bunyip-tex [flags] file...

Each input writes \<name>.ktx2 beside it, or into -outdir, or to -o when there is one input. The flags:

	-format bc1|bc3|bc4|bc5|bc7|rgba   what to compress to (default bc7)
	-linear                            the file holds data, not sRGB colour
	-no-mips                           write level 0 alone
	-fast                              skip BC7's two-subset search
	-o file                            write one output here
	-outdir dir                        write every output into this directory
	-v                                 report each file's size and quality

Pick the format by what the texture is for: bc7 for colour that has to hold up close, bc1 for opaque colour at half BC7's block size, bc3 for colour with alpha at the same block size as BC7, bc4 for a one-channel mask or height field and bc5 for a tangent-space normal map. A normal map, a mask or a roughness map is data rather than colour, so it wants -linear; bc4 and bc5 are always linear whatever the flag says.
