Skip to main content

ideal_format

Function ideal_format 

Source
pub fn ideal_format(
    source: PixelDescriptor,
    intent: ConvertIntent,
) -> PixelDescriptor
Expand description

Recommend the ideal working format for a given intent, based on the source format.

Unlike best_match, this isn’t constrained to a list — it returns what the consumer should be working in for optimal results.

Key principles:

  • Fastest preserves the source format (identity).
  • LinearLight upgrades to f32 Linear for gamma-correct operations.
  • Blend upgrades to f32 Linear with premultiplied alpha.
  • Perceptual keeps u8 sRGB for SDR-8 sources (LUT-fast), upgrades others to f32 sRGB.
  • Never downgrades precision — a u16 source won’t be recommended as u8.