P3Image

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

Note: This class supports indexing and assigning values ​​to specific pixels via 1D or 2D indexing, and provides P3 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 *.ppm.

Typical usage:

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

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

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.PPM_TEXT)
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