Options for oxipng optimization.
Available Options
:level- Optimization preset from0to6(default:2).:interlace- Interlacing mode:nilor:keep(default) - Keep original interlacing.true- Request interlacing (Adam7).false- Request removal of interlacing.
Changes can be skipped if output is not smaller. Set
force: trueto apply the requested interlacing even without a size improvement.:strip- Metadata stripping::noneorfalse(default) - Disable optional metadata stripping.:safeortrue- Use oxipng's metadata allowlist:cICP,iCCP,sRGB,pHYs,acTL,fcTL, andfdAT. This removesgAMAandcHRMand can affect image appearance.:all- Strip all optional metadata including color profiles.{:keep, list}- Keep only specific chunk names (e.g.{:keep, ["tEXt", "iTXt"]}).{:strip, list}- Strip specific chunk names (e.g.{:strip, ["iCCP"]}).
:optimize_alpha- Allow transparency color values to be altered to improve compression when fully transparent (default:false).:bit_depth_reduction- Attempt bit depth reduction (default:true).:color_type_reduction- Attempt color type reduction (default:true).:palette_reduction- Attempt palette reduction (default:true).:grayscale_reduction- Attempt grayscale reduction (default:true).:idat_recoding- Recode IDAT chunks (default:true). Reductions can require recoding even when this isfalse.:scale_16- Allow lossy scaling from 16-bit to 8-bit when bit depth reduction is enabled (default:false).:fast_evaluation- Whether to use fast evaluation to pick the best filter (default:nil, uses preset default).:force- Return or write output even if it is not smaller than input (default:false).:fix_errors- Attempt to fix errors when decoding rather than failing (default:false).:timeout- Soft optimization budget in milliseconds (default:nil). Skips further work after the deadline; does not interrupt compression already running, so the call can take longer.:max_decompressed_size- Maximum decompressed size of input in bytes (default:nil).:deflater- DEFLATE algorithm:{:libdeflater, 0..12}- Use libdeflater with compression level.:zopfli- Use Zopfli with default 15 iterations.{:zopfli, iterations}- Use Zopfli with specified iteration count.{:zopfli, iterations, without_improvement}- Use Zopfli with iteration limits.
:filters- List of filter strategies to try:- Any combination of
:none,:sub,:up,:average,:paeth,:min_sum,:entropy,:bigrams,:big_ent, or{:brute, num_lines, level}.
- Any combination of
:preserve_attrs- In file optimization, preserve file permissions and modification time, but not access time (default:false).
Summary
Functions
Builds and validates an %Oxipng.Options{} struct from a keyword list or map.
Same as new/1 but raises ArgumentError on invalid options.
Converts an %Oxipng.Options{} struct into a map suitable for the NIF.
Types
@type deflater_opt() :: nil | :zopfli | {:libdeflater, 0..12} | {:zopfli, pos_integer()} | {:zopfli, pos_integer(), pos_integer()}
@type filter_opt() :: :none | :sub | :up | :average | :paeth | :min_sum | :entropy | :bigrams | :big_ent | {:brute, pos_integer(), 1..12}
@type interlace() :: nil | :keep | boolean()
@type level() :: 0..6
@type t() :: %Oxipng.Options{ bit_depth_reduction: boolean(), color_type_reduction: boolean(), deflater: deflater_opt(), fast_evaluation: boolean() | nil, filters: [filter_opt()] | nil, fix_errors: boolean(), force: boolean(), grayscale_reduction: boolean(), idat_recoding: boolean(), interlace: interlace(), level: level(), max_decompressed_size: pos_integer() | nil, optimize_alpha: boolean(), palette_reduction: boolean(), preserve_attrs: boolean(), scale_16: boolean(), strip: strip_mode(), timeout: pos_integer() | nil }
Functions
Builds and validates an %Oxipng.Options{} struct from a keyword list or map.
Same as new/1 but raises ArgumentError on invalid options.
Converts an %Oxipng.Options{} struct into a map suitable for the NIF.