35 lines
1.5 KiB
Rust
35 lines
1.5 KiB
Rust
fn main() {
|
|
let cases = &[
|
|
(
|
|
"/mnt/extra/00_PROJECTS/hcie-rust-v4/psd-test-images/stroke/stroke-inside/stroke-inside.psd",
|
|
"/mnt/extra/00_PROJECTS/hcie-rust-v4/psd-test-images/stroke/stroke-inside"
|
|
),
|
|
(
|
|
"/mnt/extra/00_PROJECTS/hcie-rust-v4/psd-test-images/stroke/stroke-outside/stroke-outside.psd",
|
|
"/mnt/extra/00_PROJECTS/hcie-rust-v4/psd-test-images/stroke/stroke-outside"
|
|
),
|
|
];
|
|
|
|
for (psd_path, png_dir) in cases {
|
|
println!("Checking PSD: {}", psd_path);
|
|
let layers = hcie_psd::import_psd(std::path::Path::new(psd_path)).unwrap();
|
|
for (idx, layer) in layers.iter().enumerate() {
|
|
if layer.pixels.iter().skip(3).step_by(4).all(|&a| a == 0) {
|
|
println!(" Layer [{}]: name='{}' is empty, skipping", idx, layer.name);
|
|
continue;
|
|
}
|
|
let png_name = format!("{}.png", layer.name);
|
|
let png_path = std::path::Path::new(png_dir).join(&png_name);
|
|
if png_path.exists() {
|
|
let img = image::open(&png_path).unwrap();
|
|
println!(" Layer [{}]: name='{}' ({}x{}) -> Found PNG: {} ({}x{})",
|
|
idx, layer.name, layer.width, layer.height, png_name, img.width(), img.height());
|
|
} else {
|
|
println!(" Layer [{}]: name='{}' ({}x{}) -> PNG NOT FOUND: {}",
|
|
idx, layer.name, layer.width, layer.height, png_path.display());
|
|
}
|
|
}
|
|
println!();
|
|
}
|
|
}
|