Common operation mapping across bindings
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, CLI, and Image entries are for comparison and do not imply identical defaults or byte-identical outputs. The Image column lists only functions checked in the image 0.72.0 documentation or executed for this handbook. Everything else is marked not covered.
Comparison boundary: the table below reflects
govips v2.19.0,sharp 0.35.5,pyvips 3.2.0,vips CLI 8.17.3, andimage 0.72.0(Vix 0.42.0, linked to libvips 8.17.3). Check each project’s documentation and the handbook’s recipe boundaries for exact default behaviour.
Loading, export, and metadata probing
Section titled “Loading, export, and metadata probing”| Intent | govips (v2.19.0) | sharp (0.35.5) | pyvips (3.2.0) | vips CLI (8.17.3) | Image (0.72.0) |
|---|---|---|---|---|---|
| Load from file | NewImageFromFile / LoadImageFromFile |
sharp(path, options) |
Image.new_from_file |
vips ... file |
Image.open/2 |
| Load from compressed buffer | NewImageFromBuffer / LoadImageFromBuffer |
sharp(buf, options) |
Image.new_from_buffer |
— | not covered |
| Load from raw pixel memory | NewImageFromMemory(buf, w, h, bands, fmt, interp) |
sharp(buf, { raw: { width, height, channels } }) |
Image.new_from_memory(buf, w, h, bands, fmt) |
vips rawload |
not covered |
| Host image / array interop | NewImageFromGoImage / ToGoImage |
Uint8Array.buffer + raw |
Image.new_from_array / np.asarray(img) |
— | not covered |
| Streaming read and write | NewImageFromReader + SaveToWriter* |
sharp() (Duplex Stream) |
SourceCustom + TargetCustom |
[descriptor=0] / .ext[descriptor=1] |
not covered |
| Load all animation frames / pages | importParams.NumPages.Set(-1) |
sharp(input, { animated: true }) |
new_from_file(path, n=-1) |
'file.gif[n=-1]' |
not covered |
| Export to memory buffer | ExportJpeg / ExportPng / ExportWebp / ExportAvif |
.jpeg().toBuffer() etc. |
write_to_buffer(".webp[Q=82]") |
— | not covered |
| Header-only format & metadata probe | DetermineImageType + Width/Height/Bands/Pages |
await sharp(input).metadata() |
Image.new_from_file properties & get_typeof |
vipsheader -a |
not covered |
| Strip metadata while keeping ICC | RemoveMetadata("icc-profile-data") |
Stripped by default (.keepIccProfile() to retain) |
write_to_file(..., keep="icc") |
--keep icc |
not covered |
| Pixel stats & single-point sampling | Stats() / Average() / GetPoint(x, y) |
await sharp(input).stats() |
stats() / avg() / getpoint(x, y) |
vips stats / vips avg / vips getpoint |
not covered |
Geometry and canvas transforms
Section titled “Geometry and canvas transforms”| Intent | govips (v2.19.0) | sharp (0.35.5) | pyvips (3.2.0) | vips CLI (8.17.3) | Image (0.72.0) |
|---|---|---|---|---|---|
| Shrink-on-load thumbnail | NewThumbnailWithSizeFromFile / LoadThumbnailFromBuffer |
.resize(w, h, { fit }) |
Image.thumbnail / Image.thumbnail_buffer |
vips thumbnail |
Image.thumbnail/3 |
| In-memory thumbnail of loaded image | ThumbnailWithSize(w, h, crop, size) |
.resize(w, h, { fit }) |
image.thumbnail_image(w, height=h) |
vips thumbnail_image |
Image.thumbnail/3 |
| Relative-scale resize | Resize(scale, kernel) / ResizeWithVScale(h, v, kernel) |
.resize(...) (pixel dimensions) |
resize(scale, vscale=...) |
vips resize |
Image.resize/3 |
| Rectangular crop | ExtractArea(left, top, width, height) |
.extract({ left, top, width, height }) |
crop(left, top, width, height) |
vips crop |
Image.crop/5 |
| Content-aware smart crop | SmartCrop(width, height, InterestingEntropy | InterestingAttention) |
.resize(w, h, { fit: 'cover', position: sharp.strategy.entropy }) |
smartcrop(w, h, interesting=...) |
vips smartcrop |
not covered |
| Auto-detect / trim uniform borders | FindTrim(threshold, bg) + ExtractArea |
.trim({ threshold, background }) |
find_trim(threshold=..., background=...) + crop |
vips find_trim |
Image.trim/2 |
| Auto-orient by EXIF Orientation | AutoRotate() |
.autoOrient() (or no-arg .rotate()) |
autorot() |
vips autorot |
Image.autorotate/1 |
| Fixed orthogonal rotate (90°/180°/270°) | Rotate(Angle90 | Angle180 | Angle270) |
.rotate(90 | 180 | 270) |
rot("d90" | "d180" | "d270") |
vips rot |
Image.rotate/3 (integer multiples of 90° use a discrete rotate) |
| Arbitrary-angle rotate & 2×2 affine | Similarity(scale, angle, bg, ...) |
.rotate(angle) / .affine(matrix, options) |
similarity(angle=...) / affine(matrix) |
vips similarity / vips affine |
Image.rotate/3; affine not covered |
| Flip (vertical / horizontal) | Flip(DirectionVertical | DirectionHorizontal) |
.flip() (vertical) / .flop() (horizontal) |
flip("vertical" | "horizontal") |
vips flip |
Image.flip/2 (:horizontal / :vertical) |
| Canvas extension & edge modes | Embed(x, y, w, h, extend) / EmbedBackground |
.extend({ top, bottom, left, right, extendWith }) |
embed(x, y, w, h, extend=...) |
vips embed |
not covered |
| Compass-aligned padding | Gravity(direction, w, h) |
.resize(w, h, { fit: 'contain', position }) |
gravity(direction, w, h) |
vips gravity |
not covered |
| Two-image join & multi-image grid | Join / ArrayJoin(images, across) |
sharp([...], { join: { across, shim } }) |
join / Image.arrayjoin(images, across=...) |
vips join / vips arrayjoin |
not covered |
Composition, masks, colour, and filtering
Section titled “Composition, masks, colour, and filtering”| Intent | govips (v2.19.0) | sharp (0.35.5) | pyvips (3.2.0) | vips CLI (8.17.3) | Image (0.72.0) |
|---|---|---|---|---|---|
| Layer overlay / composite | Composite / CompositeMulti |
.composite([...]) |
composite / composite2 |
vips composite / vips composite2 |
not covered |
| Pango text & SVG vector rendering | Label(...) or load SVG |
.composite([{ input: { text } }]) or load SVG |
Image.text(...) or svgload |
vips text / vips svgload |
not covered |
| Add / remove / flatten alpha | AddAlpha / ExtractBand(0, 3) / Flatten |
.ensureAlpha() / .removeAlpha() / .flatten() |
addalpha() / img[0:3] / flatten() |
vips addalpha / vips extract_band / vips flatten |
Image.flatten/2; adding and removing channels not covered |
| Premultiply & unpremultiply alpha | PremultiplyAlpha() / UnpremultiplyAlpha() |
composite({ premultiplied }) |
premultiply() / unpremultiply() |
vips premultiply / vips unpremultiply |
not covered |
| Extract & append channels | ExtractBand(band, num) / BandJoin / BandJoinConst |
.extractChannel(ch) / .joinChannel(img) |
extract_band / bandjoin / bandjoin_const |
vips extract_band / vips bandjoin |
not covered |
| Conditional mask blending | Composite (BlendModeDestIn / BlendModeOver) |
.composite([{ blend: 'dest-in' }]) |
mask.ifthenelse(fg, bg, blend=True) |
vips ifthenelse --blend |
not covered |
| Colourspace & ICC transform | ToColorSpace / TransformICCProfile |
.toColourspace() / .withIccProfile() |
colourspace() / icc_transform() |
vips colourspace / vips icc_transform |
not covered |
| Brightness / saturation / hue | Modulate(b, s, h) / ModulateHSV(b, s, h) |
.modulate({ brightness, saturation, hue }) |
colourspace("lch") + linear + colourspace("srgb") |
vips colourspace + vips linear |
Image.modulate/2 |
| Linear math, 3×3 matrix & inversion | Linear / Recomb(matrix) / Invert() |
.linear(a, b) / .recomb(matrix) / .negate() |
linear / recomb / invert() |
vips linear / vips recomb / vips invert |
not covered |
| Gaussian blur & USM sharpen | GaussianBlur(sigma) / Sharpen(sigma, x1, m2) |
.blur(sigma) / .sharpen({ sigma, m1, m2, x1, y2, y3 }) |
gaussblur(sigma) / sharpen(...) |
vips gaussblur / vips sharpen |
Image.blur/2 / Image.sharpen/2 |
| Median filter, convolution & edges | Rank(w, h, idx) / Sobel() (canny/conv only in unexported vipsGen*) |
.median(size) / .convolve({ width, height, kernel }) |
median(size) / rank / conv / sobel / canny |
vips rank / vips conv / vips sobel / vips canny |
not covered |
| Histogram equalization & CLAHE | HistogramNormalise() / HistogramFind() |
.normalise() / .clahe({ width, height, maxSlope }) |
hist_norm() / hist_equal() / hist_local(...) |
vips hist_norm / vips hist_local |
not covered |
| Deep Zoom pyramid tiles | Not wrapped (dzsave via CLI/sharp/pyvips) |
.tile({ size, overlap, layout: 'dz' }) |
dzsave(basename, ...) |
vips dzsave |
not covered |
- Unit difference:
Resizein govips and libvips takes a relative scale factor (1.0= 100%), whileThumbnail*andsharp.resize(w, h)take target pixel dimensions. Do not read govipsResizewithsharp.resize(w, h)semantics.Image.resize/3also takes a scale factor.Image.thumbnail/3takes a side length or a"WxH"string. - Rotation and flip entry points: in govips, 90°-multiple orthogonal rotations use the enum-based
Rotate, whereas arbitrary angles useSimilarity; in sharp,.flip()is vertical while.flop()is horizontal.Image.flip/2uses:horizontaland:vertical. In image 0.72.0, an omitted:backgrounduses the libvips fill: transparent when the image has alpha, and black in most other cases. - Load vs thumbnail path:
Thumbnail*uses libvips’ shrink-on-load path by target size, which has dramatically lower memory and latency than decoding a full image first and then callingResize(see Thumbnails and shrink-on-load). - Animation: transform an animation only after loading all pages with
NumPages=-1(animated: true/n=-1); see Animated images and the toilet-roll frame model.