use miette::{IntoDiagnostic, Result}; use std::env; use std::fs; use std::path::Path; fn main() -> Result<()> { let args: Vec = env::args().collect(); if args.len() != 2 { eprintln!("Usage: {} ", args[0]); eprintln!("\nComputes perceptual hash (aHash/average hash) for an image."); eprintln!("Outputs 16-character hex string (64-bit hash)."); std::process::exit(1); } let image_path = Path::new(&args[1]); if !image_path.exists() { eprintln!("Error: File not found: {}", image_path.display()); std::process::exit(1); } // Read image bytes let image_bytes = fs::read(image_path).into_diagnostic()?; // Compute phash let phash = skywatch_phash_rs::processor::phash::compute_phash(&image_bytes)?; // Output just the hash println!("{}", phash); Ok(()) }