Amiga.org

Operating System Specific Discussions => Amiga OS => Amiga OS -- Development => Topic started by: Hardboy on April 08, 2003, 10:59:56 PM

Title: Uncompressed Graphic Format
Post by: Hardboy on April 08, 2003, 10:59:56 PM
Hi,

I´m searching for am uncompressed graphic file format. Does anyone know a simple one? I´d prefer a format which stores pixels in RGB.

Title: Re: Uncompressed Graphic Format
Post by: olegil on April 08, 2003, 11:07:08 PM
ILBM? (IFF interleaved bitmap)

TIFF? (tag image file format)

PPM? (Portable Pixel Map) (search for ppm and netpbm)

That being said, I don't think you can get much simpler than uncompressed IFF if you're programming for Amiga. If you're talking Linux, I would suggest PPM, since there's a ####LOAD of applications that support this out of the box, and the format is totally open.
If we're talking Windows, I might be persuaded to suggest TIFF. It's well supported under AmigaOS and Linux as well, so really isn't that bad. I don't know how good the documentation is, though. There's some libraries you can use...
Title: Re: Uncompressed Graphic Format
Post by: Hardboy on April 08, 2003, 11:14:27 PM
Thanks!

It really doesn´t matter how supported it is. It´s because I´m testing some compressing techniques, and need some simple format to load and store results in. Documentation and simple layout is most important.
Title: Re: Uncompressed Graphic Format
Post by: Karlos on April 08, 2003, 11:17:06 PM
Hi,

For true colour images, PPM is by far the simplest. For greyscale, PGM is the way to go.

PPM has an ASCII header with the following structure

P6


255


From a C perspective, reading the header is a simple as using

int width, height;
fscanf(fileName, "P6\n%d\n%d\n255\n", &width, &height);

The data is stored as triplets of bytes (red green and blue respectively), one for each pixel and follows immediately on the line after the '255' value.

PGM is very similar:

P5


255


So you could use the following to read the header

int width, height;
fscanf(fileName, "P5\n%d\n%d\n255\n", &width, &height);

Here the data consists of single bytes representing a grayscale value of 0-255.

I can't think of a simpler pair of formats that can be used within any serious image manipulation package.
Title: Re: Uncompressed Graphic Format
Post by: olegil on April 08, 2003, 11:17:06 PM
Here's the good old RTFM response :-)
uncompressed ilbm doc (http://www.newtek.com/products/lightwave/developer/75lwsdk/docs/filefmts/ilbm.html)

ppm docs (http://netpbm.sourceforge.net/doc/ppm.html)

libtiff docs (http://www.libtiff.org/libtiff.html)


Good luck. And if you choose uncompressed BMP instead of these 3 choices, I'll kill ya. Ok, so I won't kill you, but I'll get pretty mad at ya :-)
Title: Re: Uncompressed Graphic Format
Post by: olegil on April 08, 2003, 11:19:00 PM
@Karlos:

Well, if you're on the Amiga IFF is _kind_ of standard, so it makes sense to use that. Then the user could use the pictures in ANY other program. I like netpbm, though.
Title: Re: Uncompressed Graphic Format
Post by: Karlos on April 08, 2003, 11:22:46 PM
Quote

olegil wrote:
@Karlos:

Well, if you're on the Amiga IFF is _kind_ of standard, so it makes sense to use that. Then the user could use the pictures in ANY other program. I like netpbm, though.


Perhaps, but he did ask for the simplest uncompressed formats with RGB pixels. AFAIK, you can't get simpler than ppm :-) Well, raw is simpler but not much use!
Besides, pgm/ppm is supported by all the amiga graphics apps that I know (apart from dpaint). Plus it works on lots of other platforms too.
Title: Re: Uncompressed Graphic Format
Post by: olegil on April 08, 2003, 11:28:23 PM
Yep. PPM is dead simple. But so is IFF. You need to add a header in both cases.