Skip to content
/ tim-cli Public

command line texture + palette packing tool for the Sony Playstation's TIM image format

Notifications You must be signed in to change notification settings

jw0z96/tim-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tim-cli

A small collection of command line tooling for creating and viewing TIM image files, as used on the Sony Playstation.

timpack

Packs texture data and palette data into the TIM file format.

Usage

Texture Preparation

This tool expects the texture data to be pre-quantised, and for the colours to map directly to those within the first palette supplied. To generate these, use ImageMagick:

# Convert an arbritrary input image to 16 or 256 colours
convert input.png \
	-colors 16 \ # 16 for 4bpp, 256 for 8bpp
	output_quantised.png

# Extract the unique colour values to generate a palette
convert output_quantised.png \
	-unique-colors \
	output_palette.png

Experiment with ImageMagick's dithering options (-dither Riemersma & -dither FloydSteinberg) when generating the quantised image if necessary.

Please ensure that the generated palette image contains the correct number of colours for the selected format (16 for 4bpp, 256 for 8bpp), or a multiple of these if using multiple palettes. If the palette generated by ImageMagick contains fewer colours than requested (which may be valid if the input image already had fewer than the specified number of colours), amend it in your image editor of choice such that the image dimensions are those of a valid palette.

Tool Usage

timpack --bpp=4 \ # 4 for 16 colour, 8 for 256 colour
	--texture=<texture file> \
	--texture-x=<X coordinate> \ # Texture destination X coordinate in VRAM
	--texture-y=<Y coordinate> \ # Texture destination Y coordinate in VRAM
	--palette=<palette file> \
	--palette-x=<X coordinate> \ # Palette destination X coordinate in VRAM
	--palette-y=<Y coordinate> \ # Palette destination Y coordinate in VRAM
	<output TIM file>

TODO

  • support handling different semitransparency modes. alpha channel support has been added, where stp is on only if the opacity 255.
  • support 15 and 24 bit direct colour modes
  • support passing an indexed texture directly, to skip the clut matching step

timview

SDL-based viewer for TIM files.

Usage

timview <TIM file>

If multiple palettes are present, pressing any key will cycle through each CLUT.

Pressing any key will also toggle clearing the background between white and black, to help view textures with alpha.

TODO

  • find a better way of viewing textures with alpha
  • support 15 and 24 bit direct colour modes

About

command line texture + palette packing tool for the Sony Playstation's TIM image format

Topics

Resources

Stars

Watchers

Forks