tga ~develop

TGA image format support library


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

TGA

TARGA image format support for the D programming language.

The library provides simple data types (Pixel, Image etc.) that might come in handy whenever image processing or synthesis is required. A set of functions to manipulate those types (I/O, transforms and more) is also included.

The library currently supports any combination of the following:

  • grayscale, color-mapped and true-color images,
  • 8, 16, 24 and 32 bit color depth,
  • raw and RLE format.
  • image origin, pixel order.

Installation

The project is built using dub and can be used as a package dependency:

{
    "dependencies": {
        "tga" : ">=0.1.0"
    }
}

Usage

Basic usage includes reading images, manipulating the pixel data, saving the image in a specified format or creating an image entirely from scratch.

Reading and processing image

import tga;

File inFile = File("input.tga");
Image img = readImage(inFile);

/* process the image in some way */
process(img.pixels, img.header.width, img.header.height);

File outFile = File("output.tga");
writeImage(outFile, img);


Generating an image

import tga;

/* generate pixels in some way */
Pixel[] pixels = generateImage(width, height);

Image img = createImage(pixels, width, height, ImageType.COMPRESSED_TRUE_COLOR, pixelBitDepth);

File outFile = File("output.tga");
writeImage(outFile, img);


TODOs

  • support for TARGA Developer Area

Further reading

Most helpful sources when implementing TGA were:

  • http://www.paulbourke.net/dataformats/tga/
  • http://www.dca.fee.unicamp.br/~martino/disciplinas/ea978/tgaffs.pdf
Authors:
  • emesx
Dependencies:
none
Versions:
0.1.0 2014-Jun-21
~develop 2014-Nov-13
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 249 downloads total

Score:
0.2
Short URL:
tga.dub.pm