[][src]Function pbrt::core::imageio::write_image

pub fn write_image(
    name: &str,
    rgb: &Vec<Float>,
    output_bounds: Bounds2i,
    _total_resolution: Point2i
)

Writes the RGB pixel data in rgb to name. File format is chosen based on the files extension, only PNG is currently supported.

Examples

use pbrt::core::geometry::Bounds2i;
use pbrt::core::geometry::Point2i;
use pbrt::core::imageio::write_image;

let data = vec![
    255., 0., 0., //
    255., 255., 0., //
    0., 0., 255., //
    0., 255., 0., //
];
let b = Bounds2i::from([[0, 0], [2, 2]]);
let res = Point2i::from([2, 2]);
write_image("target/doc/pbrt/test.png", &data, b, res);