//! Writes the ICC profile the library embeds in a PDF/A file.
//!
//! Our own tests can only say the bytes look right to us. Whether they are an
//! ICC profile — and whether that profile is really sRGB rather than something
//! wearing its name — is a question for a colour engine, which is what
//! `scripts/check_icc_profile.py` uses this for.
//!
//! Usage: `cargo run --example write_icc -- tmp/srgb.icc`
use std::env;
use std::fs;
use std::path::Path;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let out = env::args()
.nth(1)
.unwrap_or_else(|| "tmp/srgb.icc".to_owned());
let profile = hqf_pdf::color::icc::srgb();
if let Some(parent) = Path::new(&out).parent() {
fs::create_dir_all(parent)?;
}
fs::write(&out, &profile)?;
println!("wrote {out}: {} bytes", profile.len());
Ok(())
}