P5Image

A class that provides the ability to work with color images in P5 format. NB: The format is raw binary.

Note: This class supports indexing and assigning values ​​to specific pixels via 1D or 2D indexing, and provides P5 file loading/saving capabilities. According to the accepted convention, in the original description of the format inside the Netpbm package, the extension of these files should be *.pgm.

Typical usage:

auto img = new P5Image;  					// creating of empty image
img.load(`Lenna.pgm`);   					// load image from file `Lenna.pgm`
img[10, 10] = new RGBColor(255, 255, 255); 	// change pixel at coords (10; 10), now are white
img[10].writeln;							// get color of 11th pixel
img.save(`Lenna2.pgm`);						// save file as `Lenna2.pgm`

auto img2 = new P5Image(10, 10, new RGBColor(0, 0, 0)); // creating image of 10x10, all pixels are black
img2[10] = img2[10] * 2; 									// increasing luminance by two
img2.save(`test.pgm`);										// save as `test.pgm`

Members

Functions

loader
void loader()
Undocumented in source. Be warned that the author may not have intended to support it.
saver
void saver()
Undocumented in source. Be warned that the author may not have intended to support it.

Mixins

__anonymous
mixin addConstructor!(PixMapFormat.PGM_BINARY)
Undocumented in source.

Inherited Members

From PixMapFile

_file
File _file;
Undocumented in source.
_header
PixMapFormat _header;
Undocumented in source.
loader
void loader()
Undocumented in source.
saver
void saver()
Undocumented in source.
load
void load(string filename)

Basic file loading procedure

save
void save(string filename)

Basic file saving procedure

isBinaryFormat
bool isBinaryFormat()

Is raw format ?

isTextFormat
bool isTextFormat()

Is text format ?

image
PixMapImage image()

Get image object as PixMapImage object

image
void image(PixMapImage image)

Set image object as PixMapImage object

Meta