mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 19:38:12 +08:00
Raw-rs: add post-processing steps (#1923)
* add convert_to_rgb step * add code to generate gamma correction curve * add gamma correction step * fix clippy warnings and cargo fmt * remove unnecessary dependencies * Code review 1 * Code review 2 * fix the order of operations * Code review 3 --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
40fd4473a7
commit
a7840b252d
@@ -6,7 +6,6 @@ use raw_rs::RawImage;
|
||||
use image::codecs::png::{CompressionType, FilterType, PngEncoder};
|
||||
use image::{ColorType, ImageEncoder};
|
||||
use libraw::Processor;
|
||||
use palette::{LinSrgb, Srgb};
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::Write;
|
||||
use std::fs::{read_dir, File};
|
||||
@@ -69,16 +68,6 @@ fn test_images_match_with_libraw() {
|
||||
}
|
||||
|
||||
fn store_image(path: &Path, suffix: &str, data: &mut [u8], width: usize, height: usize) {
|
||||
if suffix == "raw_rs" {
|
||||
for pixel in data.chunks_mut(3) {
|
||||
let lin_srgb: LinSrgb<f64> = LinSrgb::new(pixel[0], pixel[1], pixel[2]).into_format();
|
||||
let output: Srgb<u8> = Srgb::from_linear(lin_srgb);
|
||||
pixel[0] = output.red;
|
||||
pixel[1] = output.green;
|
||||
pixel[2] = output.blue;
|
||||
}
|
||||
}
|
||||
|
||||
let mut output_path = PathBuf::new();
|
||||
if let Some(parent) = path.parent() {
|
||||
output_path.push(parent);
|
||||
|
||||
Reference in New Issue
Block a user