Skip to main content

Image

The Image Tool is a universal image converter that supports batch processing and flexible command sequences. It can process 2D, 3D, Cube, and 2D Array image types using a powerful set of command-line options.

The tool supports both CPU (multi-threaded) and GPU-based compression into BC1-BC7 and ASTC texture formats. GPU compression provides a significant performance advantage over CPU-based methods.

Multiple images can be composed into or decomposed from 3D, Cube, or 2D Array images.

Usage Example

Convert six individual images into a single cube texture and compress it into BC1 and ASTC66 formats:

#!/bin/bash

SIZE=4096
NAME=color

ts_image -v -create rgbu8n $SIZE $((SIZE * 6)) \
$NAME.0.png -insert 0 $((SIZE * 0)) -remove \
$NAME.1.png -insert 0 $((SIZE * 1)) -remove \
$NAME.2.png -insert 0 $((SIZE * 2)) -remove \
$NAME.3.png -insert 0 $((SIZE * 3)) -remove \
$NAME.4.png -insert 0 $((SIZE * 4)) -remove \
$NAME.5.png -insert 0 $((SIZE * 5)) -remove \
-cube -mipmaps gamma \
-clone -push -format bc1rgbu8n -o ../$NAME.bc1.image best -remove -pop \
-clone -push -format astc66rgbau8n -o ../$NAME.astc.image best -remove -pop

Convert all textures in the textures directory to the BC7 format and export them as *.image files into the textures.bc7 directory with the best compression:

#!/bin/bash

POSTFIX=bc7
FORMAT=bc7rgbau8n

pushd textures

ts_image -v ./*_d.png -mipmaps gamma -f $FORMAT -prefix ../textures.$POSTFIX/ -e image best
ts_image -v ./*_d_*.png -mipmaps gamma -f $FORMAT -prefix ../textures.$POSTFIX/ -e image best
ts_image -v ./*_gray.png -mipmaps gamma -f $FORMAT -prefix ../textures.$POSTFIX/ -e image best
ts_image -v ./*_yellow.png -mipmaps gamma -f $FORMAT -prefix ../textures.$POSTFIX/ -e image best

ts_image -v ./*_n.png -mipmaps -f $FORMAT -prefix ../textures.$POSTFIX/ -e image best
ts_image -v ./*_m.png -mipmaps -f $FORMAT -prefix ../textures.$POSTFIX/ -e image best
ts_image -v ./*_e.png -mipmaps -f $FORMAT -prefix ../textures.$POSTFIX/ -e image best

popd

Command Line Parameters

Tellusim Image Processing Tool
Usage: ts_image file.png <commands> -o file.jpg
Load file formats: astc, bmp, bw, cur, dds, dem, exr, hdr, hgt, ico, image, jpeg, jpg, ktx, la, pbm, pgm, png, ppm, psd, rgb, rgba, sgi, tga, tif, tiff, webp
Save file formats: astc, bmp, bw, cur, dds, exr, hdr, ico, image, jpeg, jpg, ktx, la, pbm, pgm, png, ppm, psd, rgb, rgba, sgi, tga, tif, tiff, webp
-verbose Verbose output
-info Get images info
-list Print image formats
-end End batch processing
-remove Remove last image
-clone Clone last image
-push Push last image
-pop Pop last image
-o <filename> (options) Output image (fast, best)
-e <extension> (options) Output extension (fast, best)
-p <postfix> Output postfix
-prefix <prefix> Output prefix
-quality <quality> Output quality
-swap <c0> <c1> Swap components
-copy <c0> <c1> Copy component
-flipx Flip horizontally
-flipy Flip vertically
-2d (options) Convert to 2D type (panorama)
-3d Convert to 3D type
-cube Convert to Cube type
-array Convert to array
-combine Combine components
-decombine Decombine components
-grid <w> Convert to grid
-format <fmt> (options) Convert to format (fast, best, perceptual, normalize, gamma, srgb, gpu)
-face <face> Get image face
-layer <layer> Get image layer
-mipmap <mipmap> Get image mipmap
-component <index> Get image component
-region <x> <y> <w> <h> Get image region
-resize <w> <h> (options) Resize image (point, linear, *cubic*, *sinc*, box, max, min, gamma)
-scale <factor> (options) Scale image (point, linear, *cubic*, *sinc*, box, max, min, gamma)
-rotate <angle> Rotate image in degrees
-mipmaps (options) Create mipmaps (point, box, max, min, *mip*, gamma)
-insert <x> <y> Insert last image data at offset
-clear <r> <g> <b> <a> Clear image color
-mul <r> <g> <b> <a> Multiply image color
-add <r> <g> <b> <a> Add image color
-create (type) <fmt> <...> Create 2D or type image
-compare (threshold) Compare images
-meta Print meta info