Fall 2003

Reading and Writing Targa Files

For your CS559 projects and programming assignments, you will need to read and write images.

We have decided to use the TARGA (.tga) image file format for this class. Mainly because the format is very simple.

Even though the format is very simple, we do not expect you to write your own tools to read and write the files. A former 559 student (Alex Mohr, who now works at Pixar) wrote a simple 559 reading/writing library for use by other 559 students.

The version of the targa reading/writing library that we are providing here is not the final one that we have written. Its an old version that is very simple. It isn't neccessarily the most efficient, and it doesn't necessarily handle every single type of targa image. We will not expect your programs to handle images that libtarga does not.

To use libtarga, you only need to include its two files libtarga.c and libtarga.h in your project.

For an example program that uses it, look at TargaWindow.cpp and TargaWindow.h, and main.cpp. We've even provided a project file.

Here's a much more interesting example (although it provides the same functionality)