Operations Reference
Complete reference of all available image operations in libvips_ffi.
Resizing & Geometry
resize
Resize an image by width, height, or scale factor.
pipeline.resize(width: 800) // By width
pipeline.resize(height: 600) // By height
pipeline.resize(width: 800, height: 600) // Both (may change aspect ratio)
pipeline.resize(scale: 0.5) // By scale factor
thumbnail
Create a thumbnail with smart cropping.
pipeline.thumbnail(
width: 200,
height: 200,
crop: VipsCrop.attention, // Smart crop focusing on interesting areas
)
Crop options:
VipsCrop.none- No croppingVipsCrop.centre- Crop from centerVipsCrop.attention- Focus on interesting areasVipsCrop.entropy- Crop based on entropyVipsCrop.low- Crop from top/leftVipsCrop.high- Crop from bottom/right
crop
Extract a rectangular region.
pipeline.crop(x: 100, y: 100, width: 400, height: 300)
smartCrop
Automatically crop to the most interesting region.
pipeline.smartCrop(
width: 400,
height: 300,
interesting: VipsInteresting.attention,
)
rotate
Rotate the image by a specific angle.
pipeline.rotate(angle: 90) // Rotate 90 degrees clockwise
pipeline.rotate(angle: -45) // Rotate 45 degrees counter-clockwise
autoRotate
Auto-rotate based on EXIF orientation data.
pipeline.autoRotate()
flip
Flip the image horizontally or vertically.
pipeline.flipHorizontal()
pipeline.flipVertical()
Color Adjustments
brightness
Adjust image brightness.
pipeline.brightness(factor: 1.2) // 20% brighter
pipeline.brightness(factor: 0.8) // 20% darker
contrast
Adjust image contrast.
pipeline.contrast(factor: 1.2) // 20% more contrast
pipeline.contrast(factor: 0.8) // 20% less contrast
saturation
Adjust color saturation.
pipeline.saturation(factor: 1.5) // More saturated
pipeline.saturation(factor: 0.5) // Less saturated
grayscale
Convert to grayscale.
pipeline.grayscale()
invert
Invert colors (negative).
pipeline.invert()
Filters & Effects
gaussianBlur
Apply Gaussian blur.
pipeline.gaussianBlur(sigma: 2.0) // Blur with sigma=2
sharpen
Sharpen the image.
pipeline.sharpen()
pipeline.sharpen(sigma: 1.5) // Custom sigma
clamp
Clamp pixel values to a range.
pipeline.clamp(min: 0, max: 255)
houghCircle
Detect circles using Hough transform.
pipeline.houghCircle(
scale: 3,
minRadius: 10,
maxRadius: 100,
)
houghLine
Detect lines using Hough transform.
pipeline.houghLine(
width: 256,
height: 256,
)
Convolution
conv
Apply a convolution kernel.
pipeline.conv(kernel: myKernel)
convsep
Apply a separable convolution.
pipeline.convsep(kernel: myKernel)
compass
Apply a compass convolution.
pipeline.compass(mask: myMask)
Composite Operations
composite
Composite multiple images.
pipeline.composite(
overlay: overlayImage,
mode: VipsBlendMode.over,
x: 100,
y: 50,
)
insert
Insert an image at a position.
pipeline.insert(
image: subImage,
x: 100,
y: 100,
)
Morphology
morph
Apply morphological operations.
pipeline.morph(mask: myMask, morph: VipsMorph.dilate)
pipeline.morph(mask: myMask, morph: VipsMorph.erode)
rank
Rank filter (median, min, max).
pipeline.rank(width: 3, height: 3, index: 4) // Median 3x3
Histogram
histFind
Find histogram.
final hist = pipeline.histFind()
histNorm
Normalize histogram.
pipeline.histNorm()
histEqual
Histogram equalization.
pipeline.histEqual()
Output Formats
See Output Formats for detailed format options.
pipeline.toJpeg(quality: 85)
pipeline.toPng(compression: 6)
pipeline.toWebp(quality: 90)
pipeline.toGif()
pipeline.toTiff()
pipeline.toDeepZoom(name: 'pyramid')