Crate pcx [] [src]

Library for reading and writing PCX image format.

PCX is quite old format, it is not recommended to use it for new applications.

PCX does not contain any color space information. Today one will usually interpret it as containing colors in sRGB color space.

Example for reading PCX image:

let mut reader = pcx::Reader::from_file("test-data/marbles.pcx").unwrap();
println!("width = {}, height = {}, paletted = {}", reader.width(), reader.height(), reader.is_paletted());
for y in 0..reader.height() {
    if reader.is_paletted() {
        // call reader.next_row_paletted(...) to read next row
    } else {
        // call reader.next_row_rgb(...) or reader.next_row_rgb_separate(...) to read next row
    }
}

Example for writing PCX image:

// Create 5x5 RGB file.
let mut writer = pcx::WriterRgb::create_file("test.pcx", (5, 5), (300, 300)).unwrap();
for y in 0..5 {
    // Write 5 green pixels.
    writer.write_row(&[0, 255, 0, 0, 255, 0, 0, 255, 0, 0, 255, 0, 0, 255, 0]);
}
writer.finish().unwrap();

Modules

low_level

Low-level handling of PCX. You generally don't need to use this module.

Structs

Reader

PCX file reader.

WriterPaletted

Create paletted PCX image.

WriterRgb

Create 24-bit RGB PCX image.