Git Product home page Git Product logo

tim-cli's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.