tonhowtf/omniget · error
não consegui abrir a imagem
Error message
não consegui abrir a imagem: {} What it means
Decode failure in icon_pack run: the user-selected image file could not be opened/decoded by the image crate (corrupt bytes, unsupported codec, or permission denied), so no icon variants can be generated from it.
Solutions
- Re-export the image in a standard format (PNG/SVG rasterized to PNG)
- Verify the file is not corrupt by opening it in an image viewer
- Check file read permissions for the app process
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at src-tauri/omniget-core/src/core/tools/icon_pack.rs:171 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/aa71e3f90b1bb36d.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/icon_pack.rs:171
let png = png_bytes(&at(base, *size))?;
body.extend_from_slice(kind.as_slice());
body.extend_from_slice(&((png.len() + 8) as u32).to_be_bytes());
body.extend_from_slice(&png);
}
let mut out = Vec::with_capacity(body.len() + 8);
out.extend_from_slice(b"icns");
out.extend_from_slice(&((body.len() + 8) as u32).to_be_bytes());
out.extend_from_slice(&body);
Ok(out)
}
/// Um arquivo a gerar: o nome final e como produzir os bytes dele.
type IconJob<'a> = (String, Box<dyn Fn() -> anyhow::Result<Vec<u8>> + 'a>);
pub fn run(opts: &IconOptions, progress: &super::ProgressFn) -> anyhow::Result<IconResult> {
let inp = Path::new(&opts.input);
let src = image::open(inp)
.map_err(|e| anyhow!("não consegui abrir a imagem: {}", e))?
.to_rgba8();
let source_size = (src.width(), src.height());
let base = squarify(&src, opts.padding_pct);
let bg = parse_hex(&opts.background);
let stem = inp
.file_stem()
.map(|s| s.to_string_lossy().to_string())
.unwrap_or_else(|| "icone".into());
let parent = if opts.output_dir.trim().is_empty() {
inp.parent().map(|p| p.to_path_buf()).unwrap_or_default()
} else {
PathBuf::from(opts.output_dir.trim())
};
let folder = parent.join(format!("{}-icons", stem));
std::fs::create_dir_all(&folder)?;
let mut jobs: Vec<IconJob<'_>> = Vec::new();View on GitHub (pinned to 8600b91f42)