nolibgs_hello_worlds/TIM
2021-07-23 19:21:47 +02:00
..
bousai.tim add poly textures examples 2020-12-24 20:03:45 +01:00
cubetex.tim add 3d gouraud textured cube example 2021-01-05 12:31:12 +01:00
README.md Add image>4/8bpp conversion infos 2021-07-23 19:21:47 +02:00
TIM4.png add sprite example 2020-12-22 19:25:47 +01:00
TIM4.tim add sprite example 2020-12-22 19:25:47 +01:00
TIM8.png add sprite example 2020-12-22 19:25:47 +01:00
TIM8.tim add sprite example 2020-12-22 19:25:47 +01:00
TIM16.png add sprite example 2020-12-22 19:25:47 +01:00
TIM16.tim add sprite example 2020-12-22 19:25:47 +01:00

TIM files

Standard bitmap images that can be transferred directly to the PSX VRAM.

Can be 4bit or 8bit with a CLUT, 16bit or 24 bit in direct color.

You can access the TIM mode through TIM_IMAGE->mode. Mode can be :

  • 0: 4bits b0
  • 1: 8 bits b1
  • 2: 16 bits b10
  • 3: 24bits b11
  • 4: mixed b100

See FileFormat47.pdf, p.179

Tools

You can use open source tools : Gimp, Aseprite

To convert your image files to TIM, use IMG2TIM :

4bpp and 8bpp specificities

If you want to generate 4bpp and 8bpp TIMs, your original image must be in indexed mode with a palette.

  • For 8bpp, < 256 colors , and dimensions must be a multiple of 2

  • For 4bpp, < 16 colors, and dimensions must be a multiple of 4

See FileFormat47.pdf, p.182

You can use TIMTOOL.EXE from legacy PsyQ to check your TIM files, or use Lameguy64's TIMedit

Reproducing the TIM in this example

Image > 4bpp, 8bpp

To convert your images to palettized 4bpp and 8bpp pngs, you can use pngquant :

4bpp (16 colors) image :

pngquant 16 input.png -o output.png --force 

8bpp (256 colors) image :

pngquant 256 input.png -o output.png --force 

Alternatively, you can use imagemagick :

4bpp (16 colors) image :

convert input.png -colors 16 output.png 

8bpp (256 colors) image :

convert input.png -colors 256 output.png

img2tim -bpp 4 -org 512 0 -plt 0 481 -usealpha -o TIM4.tim TIM4.png 
img2tim -bpp 8 -org 512 256 -plt 0 480 -usealpha -o TIM8.tim TIM8.png 
img2tim -bpp 16 -org 768 0 -usealpha -o TIM16.tim TIM16.png 

Content of Makefile :

SRCS = hello_sprt.c \
../common/crt0/crt0.s \
TIM/TIM16.tim \
TIM/TIM8.tim \
TIM/TIM4.tim \

Links