use std::env;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let args: Vec<String> = env::args().collect();
let output_path = if args.len() > 1 {
&args[1]
} else {
"test_image.png"
};
println!("Creating test image: {}", output_path);
let width = 512;
let height = 512;
let mut img = image::RgbImage::new(width, height);
for y in 0..height {
for x in 0..width {
let r: u8;
let g: u8;
let b: u8;
if x < width / 2 && y < height / 2 {
r = (x * 255 / width) as u8;
g = (y * 255 / height) as u8;
b = 255;
} else if x >= width / 2 && y < height / 2 {
if (x % 32 < 2) || (y % 32 < 2) {
r = 50; g = 50; b = 50;
} else {
r = 200; g = 200; b = 200;
}
} else if x < width / 2 && y >= height / 2 {
let cx = x as i32 - (width / 4) as i32;
let cy = y as i32 - (height * 3 / 4) as i32;
let dist = ((cx * cx + cy * cy) as f32).sqrt();
if dist < 80.0 {
r = 255; g = 100; b = 100;
} else if (x / 20) % 2 == 0 {
r = 100; g = 100; b = 255;
} else {
r = 255; g = 255; b = 100;
}
} else {
let fx = x as f32 * 0.1;
let fy = y as f32 * 0.1;
let noise = ((fx.sin() + fy.cos()) * 0.5 + 0.5) * 255.0;
r = 0;
g = noise as u8;
b = 0;
}
img.put_pixel(x, y, image::Rgb([r, g, b]));
}
}
img.save(output_path)?;
println!("Test image created: {}x{}", width, height);
println!("Features:");
println!(" - Top-left: Smooth gradient (good for wavelets)");
println!(" - Top-right: Random noise (good for texture synthesis)");
println!(" - Bottom-left: Sharp edges (good for wavelet edges)");
println!(" - Bottom-right: Organic patterns (good for warping)");
Ok(())
}