Skip to content

Common operation mapping across bindings

Copy page

The same product intent has different API names and parameter units across bindings. govips is the handbook’s reference implementation; the sharp, pyvips, and CLI equivalents are for comparison and do not imply identical semantics.

Comparison boundary: the govips column below is based on the v2.19.0 source. The sharp / pyvips / CLI columns are currently comparison-pending and should not be treated as run-verified by the shared runner.

Intent govips (v2.19.0) sharp pyvips vips CLI
Load from file vips.NewImageFromFile sharp(path) pyvips.Image.new_from_file vips ... file
Load from buffer LoadImageFromBuffer sharp(buf) new_from_buffer via stdin/file
Load all pages/frames importParams.NumPages.Set(-1) sharp(input, { pages: -1 }) n=-1 argument via loader arg
Export to buffer ExportWebp(params) / ExportJpeg(params); streaming SaveToWriter* .toBuffer() write_to_buffer driven by output format
Intent govips (v2.19.0) sharp pyvips vips CLI
Thumbnail to size NewThumbnailWithSizeFromFile / LoadThumbnailFromFile .resize(w,h,{fit}) thumbnail / resize vips thumbnail
Relative-scale resize Resize(scale, kernel) / ResizeWithVScale(h, v, kernel) .resize(factor) resize(scale) vips resize
Rotate Rotate(angle) (angle enum) .rotate(angle) rotate(angle) vips rot
Flip Flip .flip() flip(axis) vips flip
Crop ExtractArea .extract() crop() vips crop
Intent govips (v2.19.0) sharp pyvips vips CLI
Composite overlay Composite / ArrayJoin .composite() composite() vips composite
Colour transform TransformICCProfile (+ TransformICCProfileWithFallback) .toColourspace() colourspace() vips colourspace
Quality/decode params ImportParams built into loader argument passing CLI loader args
  • Unit difference: Resize’s scale is a relative multiplier (1.0 = 100%), while thumbnailing targets a size. Do not read govips Resize with sharp.resize(w,h) semantics.
  • Load/thumbnail path: Thumbnail* uses libvips’ decode-only-what-is-needed path by target size, which differs from loading the whole image then resizing.
  • Animation: see troubleshooting animation-multi-page; transform an animation only after loading all pages.
  • govips v2.19.0 source (NewImageFromFile, LoadImageFromBuffer, NumPages, NewThumbnailWithSizeFromFile, Resize/ResizeWithVScale, Rotate, Flip, ExtractArea, Composite, TransformICCProfile, ExportWebp).
  • The sharp / pyvips / CLI columns have not been run-verified by the shared runner and are marked comparison-pending.

Treat this mapping as product-intent-first; see each binding’s documentation for exact parameter defaults, and trust the handbook’s locked reference baseline.