Skip to content

Common operation mapping across bindings

Copy page

The same product intent has different API names and parameter units across bindings and interfaces. 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 marked comparison-pending; check each project’s documentation for exact default behaviour.

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 or file
Load all pages/frames importParams.NumPages.Set(-1) sharp(input, { pages: -1 }) n=-1 argument via loader arg [n=-1]
Export to buffer/stream ExportWebp(params) / ExportJpeg(params); streaming SaveToWriter* .toBuffer() write_to_buffer driven by output format options
Intent govips (v2.19.0) sharp pyvips vips CLI
Thumbnail to target size NewThumbnailWithSizeFromFile / LoadThumbnailFromFile .resize(w, h, { fit }) thumbnail / thumbnail_image vips thumbnail
Relative-scale resize Resize(scale, kernel) / ResizeWithVScale(h, v, kernel) .resize(...) (pixel dimensions) resize(scale) vips resize
Fixed-angle rotate (90°/180°/270°) Rotate(angle) (Angle enum) .rotate(90 | 180 | 270) rot(angle) vips rot
Arbitrary-angle rotate Similarity(scale, angle, ...) .rotate(angle) similarity(angle=...) / rotate(angle) vips similarity
Flip (vertical / horizontal) Flip(DirectionVertical | DirectionHorizontal) .flip() (vertical) / .flop() (horizontal) flip(axis) / flipver() / fliphor() vips flip
Rectangular crop ExtractArea(left, top, width, height) .extract({ left, top, width, height }) crop(left, top, width, height) vips crop
Intent govips (v2.19.0) sharp pyvips vips CLI
Layer overlay / composite Composite / CompositeMulti .composite([...]) composite / composite2 vips composite / vips composite2
Multi-image grid join ArrayJoin create canvas + .composite() arrayjoin vips arrayjoin
Colourspace & ICC transform TransformICCProfile (+ TransformICCProfileWithFallback) .toColourspace() / .withIccProfile() colourspace() / icc_transform() vips colourspace / vips icc_transform
Import / decode parameters ImportParams built into sharp(input, options) loader keyword arguments [option=value] suffix on filename
  • Unit difference: Resize in govips and libvips takes a relative scale factor (1.0 = 100%), while Thumbnail* and sharp.resize(w, h) take target pixel dimensions. Do not read govips Resize with sharp.resize(w, h) semantics.
  • Rotation entry points: in govips, 90°-multiple orthogonal rotations use the enum-based Rotate, whereas arbitrary angles use Similarity; sharp unifies both under .rotate(angle).
  • Load vs thumbnail path: Thumbnail* uses libvips’ shrink-on-load path by target size, which has different memory and latency characteristics from decoding a full image first and then calling Resize.
  • Animation: transform an animation only after loading all pages with NumPages=-1; see animation keeps one frame or becomes a tall image.
  • govips v2.19.0 source (NewImageFromFile, LoadImageFromBuffer, NumPages, NewThumbnailWithSizeFromFile, Resize / ResizeWithVScale, Rotate, Similarity, Flip, ExtractArea, Composite, ArrayJoin, TransformICCProfile, ExportWebp).
  • The sharp / pyvips / CLI columns are currently 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.