A class that provides the ability to work with color images in P6 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 P6 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:
autoimg = newP6Image; // creating of empty imageimg.load(`Lenna.ppm`); // load image from file `Lenna.ppm`img[10, 10] = newRGBColor(255, 255, 255); // change pixel at coords (10; 10), now are whiteimg[10].writeln; // get color of 11th pixelimg.save(`Lenna2.ppm`); // save file as `Lenna2.ppm`autoimg2 = newP6Image(10, 10, newRGBColor(255, 0, 255)); // creating image of 10x10, all pixels are redimg2[10] = img2[10] * 2; // increasing luminance by twoimg2.save(`test.ppm`); // save as `test.ppm`
A class that provides the ability to work with color images in P6 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 P6 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: