Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ tokio = { version = "1", features = ["full"] }
uuid = { version = "1.25", features = ["v4", "serde"] }
walkdir = "2.5.0"
imageproc = "0.27.0"
lsdetect = "0.3.0"
ort = { version = "=2.0.0-rc.10", features = ["ndarray", "load-dynamic"] }
ndarray = "0.16"
tauri-plugin-process = "2.3.1"
Expand Down
16 changes: 12 additions & 4 deletions src-tauri/src/adjustment_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,25 @@ pub fn hydrate_adjustments(state: &tauri::State<AppState>, adjustments: &mut ser
}
}

pub fn apply_spatial_transformations<'a, I: IntoCowImage<'a>>(
pub fn apply_orientation_and_flip<'a, I: IntoCowImage<'a>>(
image: I,
adjustments: &serde_json::Value,
) -> (Cow<'a, DynamicImage>, (f32, f32)) {
) -> Cow<'a, DynamicImage> {
let orientation_steps = adjustments["orientationSteps"].as_u64().unwrap_or(0) as u8;
let rotation_degrees = adjustments["rotation"].as_f64().unwrap_or(0.0) as f32;
let flip_horizontal = adjustments["flipHorizontal"].as_bool().unwrap_or(false);
let flip_vertical = adjustments["flipVertical"].as_bool().unwrap_or(false);

let coarse_rotated_image = apply_coarse_rotation(image.into_cow(), orientation_steps);
let flipped_image = apply_flip(coarse_rotated_image, flip_horizontal, flip_vertical);
apply_flip(coarse_rotated_image, flip_horizontal, flip_vertical)
}

pub fn apply_spatial_transformations<'a, I: IntoCowImage<'a>>(
image: I,
adjustments: &serde_json::Value,
) -> (Cow<'a, DynamicImage>, (f32, f32)) {
let rotation_degrees = adjustments["rotation"].as_f64().unwrap_or(0.0) as f32;

let flipped_image = apply_orientation_and_flip(image, adjustments);
let rotated_image = apply_rotation(flipped_image, rotation_degrees);

let crop_data: Option<Crop> = serde_json::from_value(adjustments["crop"].clone()).ok();
Expand Down
Loading
Loading