Skip to main content

DEFAULT_MAX_PIXELS

Constant DEFAULT_MAX_PIXELS 

Source
pub const DEFAULT_MAX_PIXELS: u64 = 100_000_000;
Expand description

The pixel cap (width * height) a default DecodeOptions applies — the safe-by-default guard against a hostile header that claims a huge image to exhaust memory.

100_000_000 (100 Mpx ≈ 400 MiB of RGBA) comfortably covers real photographs (a 100-megapixel image is already far beyond any consumer camera) while keeping a single crafted decode from allocating toward the per-side ceiling (MAX_DIMENSION² ≈ 268 Mpx ≈ 1 GiB). Raise it with DecodeOptions::max_pixels, or remove the cap entirely with DecodeOptions::unbounded when the input is trusted.