Skip to content

Default parameter differences across interfaces

Copy page

Many assume “same input + same intent = same output”, but the four interfaces expose different defaults for the same intent. The safest engineering assumption is that outputs are not byte-for-byte identical; check defaults before comparing across bindings.

NewWebpExportParams() returns:

Field Default
Quality 75
Lossless false
NearLossless false
ReductionEffort 4
StripMetadata false
TargetSize 0 (disabled)

NewJpegExportParams() returns Quality 80, Interlace true.

NewGifExportParams() returns Quality 75, Effort 7, Bitdepth 8. Note that Quality has no effect under native gifsave (see why GIF Quality has no effect); Effort and Bitdepth are what affect output.

The recipe reference baseline explicitly sets WebP output quality to 82. That is an explicit argument in the example code rather than govips’ default of 75.

  • Codec quality semantics: the sharpness/size trade-off differs per format; Quality is not a universal “sharpness” knob across formats.
  • Resize semantics: govips Resize takes a relative multiplier (and requires a Kernel), unlike sharp.resize(w, h) target-dimension semantics.
  • Metadata default: StripMetadata defaults to false in govips, meaning metadata is kept and forwarded by default (see colour shifts, missing ICC profiles, and CMYK distortion).
  • Animation pages: only the first page (n=1) is loaded by default; set NumPages=-1 explicitly for animations (see animation keeps one frame or becomes a tall image).

Why byte-for-byte identity cannot be assumed

Section titled “Why byte-for-byte identity cannot be assumed”
  • sharp 0.35.5 bundles libvips 8.18.7, which differs from the system reference 8.17.3.
  • pyvips and the CLI share the system libvips 8.17.3 with govips, but high-level wrapper defaults still need per-option confirmation.
  • Cross-interface checks currently verify format, dimensions, and band metadata; pixel-level comparison remains comparison-pending.
  • If you explicitly override all relevant encoding and interpolation parameters, default differences matter much less.
  • Underlying defaults may also evolve between libvips releases; do not rely solely on this snapshot when upgrading.
  • govips v2.19.0 source (NewWebpExportParams, NewJpegExportParams, NewGifExportParams defaults).
  • This handbook’s verification baseline (system libvips 8.17.3, sharp bundled 8.18.7).

This page records the reference govips defaults; cross-binding default comparisons for sharp, pyvips, and the CLI are marked comparison-pending.