class Vips::Image
- Vips::Image
- Vips::VipsObject
- Vips::GObject
- Reference
- Object
Direct Known Subclasses
Defined in:
vips/ext/image.crvips/image.cr
Constructors
-
.imageize(match_image : Image, value) : Image
expand a constant into an image
-
.new_from_array(array : Array, scale = 1.0, offset = 0.0) : Image
Create a new Image from a 1D or 2D array.
-
.new_from_buffer(data : String | Bytes | IO, option_string : String = "", access : Enums::Access | Nil = nil, failon : Enums::FailOn | Nil = nil, **opts) : Image
Create a new
Image
for an image encoded in a format such as JPEG in a binaryString
,Bytes
orIO
. -
.new_from_file(name : String, memory : Bool | Nil = nil, access : Enums::Access | Nil = nil, failon : Enums::FailOn | Nil = nil, **opts) : Image
Return a new
Image
for a file on disc. -
.new_from_memory(data : Bytes, width : Int32, height : Int32, bands : Int32, format : Enums::BandFormat) : Image
Wraps an Image around an area of memory containing a C-style array.
-
.new_from_memory_copy(data : Pointer(Void), size : UInt64, width : Int32, height : Int32, bands : Int32, format : Enums::BandFormat) : Image
Create a new
Image
from memory and copies the memory area. -
.new_from_source(source : Source, option_string : String = "", access : Enums::Access | Nil = nil, failon : Enums::FailOn | Nil = nil, **opts) : Image
Create a new
Image
from a source. -
.new_from_stream(stream : IO, option_string : String = "", access : Enums::Access | Nil = nil, failon : Enums::FailOn | Nil = nil, **opts) : Image
Load a formatted image from a stream This behaves exactly as
.new_from_source
, but the image is loaded from a stream rathar than from a source. -
.new_temp_file(format : String) : Image
Make a new temporary image.
Class Method Summary
-
.analyzeload(filename : String, **kwargs)
Load an analyze6 image
-
.arrayjoin(in_ : Array(Image), **kwargs)
Join an array of images
-
.black(width : Int32, height : Int32, **kwargs)
Make a black image
-
.csvload(filename : String, **kwargs)
Load csv
-
.csvload_source(source : Source, **kwargs)
Load csv
-
.csvload_stream(stream : IO, **kwargs)
Load csv
-
.eye(width : Int32, height : Int32, **kwargs)
Make an image showing the eye's spatial response
-
.find_load(filename : String)
Find the name of the load operation vips will use to load a file.
-
.find_load_buffer(data : Bytes)
Find the name of the load operation vips will use to load a buffer.
-
.find_load_buffer(data : String)
Find the name of the load operation vips will use to load a buffer.
-
.find_load_source(source : Source)
Find the name of the load operation vips will use to load a source.
-
.find_load_stream(stream : Stream)
Find the name of the load operation vips will use to load a stream.
-
.fitsload(filename : String, **kwargs)
Load a fits image
-
.fitsload_source(source : Source, **kwargs)
Load fits from a source
-
.fitsload_stream(stream : IO, **kwargs)
Load fits from a stream
-
.fractsurf(width : Int32, height : Int32, fractal_dimension : Float64)
Make a fractal surface
-
.gaussmat(sigma : Float64, min_ampl : Float64, **kwargs)
Make a gaussian image
-
.gaussnoise(width : Int32, height : Int32, **kwargs)
Make a gaussnoise image
-
.gifload(filename : String, **kwargs)
Load gif with libnsgif
-
.gifload_buffer(buffer : Bytes, **kwargs)
Load gif with libnsgif
-
.gifload_source(source : Source, **kwargs)
Load gif from source
-
.gifload_stream(stream : IO, **kwargs)
Load gif from stream
-
.grey(width : Int32, height : Int32, **kwargs)
Make a grey ramp image
-
.heifload(filename : String, **kwargs)
Load a heif image
-
.heifload_buffer(buffer : Bytes, **kwargs)
Load a heif image
-
.heifload_source(source : Source, **kwargs)
Load a heif image
-
.heifload_stream(stream : IO, **kwargs)
Load a heif image
-
.identity(**kwargs)
Make a 1d image where pixel values are indexes
-
.jp2kload(filename : String, **kwargs)
Load jpeg2000 image
-
.jp2kload_buffer(buffer : Bytes, **kwargs)
Load jpeg2000 image
-
.jp2kload_source(source : Source, **kwargs)
Load jpeg2000 image
-
.jp2kload_stream(stream : IO, **kwargs)
Load jpeg2000 image
-
.jpegload(filename : String, **kwargs)
Load jpeg from file
-
.jpegload_buffer(buffer : Bytes, **kwargs)
Load jpeg from buffer
-
.jpegload_source(source : Source, **kwargs)
Load image from jpeg source
-
.jpegload_stream(stream : IO, **kwargs)
Load image from jpeg stream
-
.jxlload(filename : String, **kwargs)
Load jpeg-xl image
-
.jxlload_buffer(buffer : Bytes, **kwargs)
Load jpeg-xl image
-
.jxlload_source(source : Source, **kwargs)
Load jpeg-xl image
-
.jxlload_stream(stream : IO, **kwargs)
Load jpeg-xl image
-
.logmat(sigma : Float64, min_ampl : Float64, **kwargs)
Make a laplacian of gaussian image
-
.magickload(filename : String, **kwargs)
Load file with imagemagick7
-
.magickload_buffer(buffer : Bytes, **kwargs)
Load buffer with imagemagick7
-
.mask_butterworth(width : Int32, height : Int32, order : Float64, frequency_cutoff : Float64, amplitude_cutoff : Float64, **kwargs)
Make a butterworth filter
-
.mask_butterworth_band(width : Int32, height : Int32, order : Float64, frequency_cutoff_x : Float64, frequency_cutoff_y : Float64, radius : Float64, amplitude_cutoff : Float64, **kwargs)
Make a butterworth_band filter
-
.mask_butterworth_ring(width : Int32, height : Int32, order : Float64, frequency_cutoff : Float64, amplitude_cutoff : Float64, ringwidth : Float64, **kwargs)
Make a butterworth ring filter
-
.mask_fractal(width : Int32, height : Int32, fractal_dimension : Float64, **kwargs)
Make fractal filter
-
.mask_gaussian(width : Int32, height : Int32, frequency_cutoff : Float64, amplitude_cutoff : Float64, **kwargs)
Make a gaussian filter
-
.mask_gaussian_band(width : Int32, height : Int32, frequency_cutoff_x : Float64, frequency_cutoff_y : Float64, radius : Float64, amplitude_cutoff : Float64, **kwargs)
Make a gaussian filter
-
.mask_gaussian_ring(width : Int32, height : Int32, frequency_cutoff : Float64, amplitude_cutoff : Float64, ringwidth : Float64, **kwargs)
Make a gaussian ring filter
-
.mask_ideal(width : Int32, height : Int32, frequency_cutoff : Float64, **kwargs)
Make an ideal filter
-
.mask_ideal_band(width : Int32, height : Int32, frequency_cutoff_x : Float64, frequency_cutoff_y : Float64, radius : Float64, **kwargs)
Make an ideal band filter
-
.mask_ideal_ring(width : Int32, height : Int32, frequency_cutoff : Float64, ringwidth : Float64, **kwargs)
Make an ideal ring filter
-
.matload(filename : String, **kwargs)
Load mat from file
-
.matrixload(filename : String, **kwargs)
Load matrix
-
.matrixload_source(source : Source, **kwargs)
Load matrix
-
.matrixload_stream(stream : IO, **kwargs)
Load matrix
-
.openexrload(filename : String, **kwargs)
Load an openexr image
-
.openslideload(filename : String, **kwargs)
Load file with openslide
-
.openslideload_source(source : Source, **kwargs)
Load source with openslide
-
.openslideload_stream(stream : IO, **kwargs)
Load stream with openslide
-
.pdfload(filename : String, **kwargs)
Load pdf from file
-
.pdfload_buffer(buffer : Bytes, **kwargs)
Load pdf from buffer
-
.pdfload_source(source : Source, **kwargs)
Load pdf from source
-
.pdfload_stream(stream : IO, **kwargs)
Load pdf from stream
-
.perlin(width : Int32, height : Int32, **kwargs)
Make a perlin noise image
-
.pngload(filename : String, **kwargs)
Load png from file
-
.pngload_buffer(buffer : Bytes, **kwargs)
Load png from buffer
-
.pngload_source(source : Source, **kwargs)
Load png from source
-
.pngload_stream(stream : IO, **kwargs)
Load png from stream
-
.ppmload(filename : String, **kwargs)
Load ppm from file
-
.ppmload_source(source : Source, **kwargs)
Load ppm base class
-
.ppmload_stream(stream : IO, **kwargs)
Load ppm base class
-
.profile_load(name : String)
Load named icc profile
-
.radload(filename : String, **kwargs)
Load a radiance image from a file
-
.radload_buffer(buffer : Bytes, **kwargs)
Load rad from buffer
-
.radload_source(source : Source, **kwargs)
Load rad from source
-
.radload_stream(stream : IO, **kwargs)
Load rad from stream
-
.rawload(filename : String, width : Int32, height : Int32, bands : Int32, **kwargs)
Load raw data from a file
-
.run_cmplx(image : Image, &block : Image -> Image)
run a complex operation on a complex image, or an image with an even number of bands ...
-
.sines(width : Int32, height : Int32, **kwargs)
Make a 2d sine wave
-
.sum(*in_ : Image)
Sum an array of images
-
.svgload(filename : String, **kwargs)
Load svg with rsvg
-
.svgload_buffer(buffer : Bytes, **kwargs)
Load svg with rsvg
-
.svgload_source(source : Source, **kwargs)
Load svg from source
-
.svgload_stream(stream : IO, **kwargs)
Load svg from stream
-
.switch(*tests : Image)
Find the index of the first non-zero pixel in tests
-
.system(cmd_format : String, **kwargs)
Run an external command
-
.text(text : String, **kwargs)
Make a text image
-
.thumbnail(filename : String, width : Int32, **kwargs)
Generate thumbnail from file
-
.thumbnail_buffer(buffer : Bytes, width : Int32, **kwargs)
Generate thumbnail from buffer
-
.thumbnail_source(source : Source, width : Int32, **kwargs)
Generate thumbnail from source
-
.thumbnail_stream(stream : IO, width : Int32, **kwargs)
Generate thumbnail from stream
-
.tiffload(filename : String, **kwargs)
Load tiff from file
-
.tiffload_buffer(buffer : Bytes, **kwargs)
Load tiff from buffer
-
.tiffload_source(source : Source, **kwargs)
Load tiff from source
-
.tiffload_stream(stream : IO, **kwargs)
Load tiff from stream
-
.tonelut(**kwargs)
Build a look-up table
-
.vipsload(filename : String, **kwargs)
Load vips from file
-
.vipsload_source(source : Source, **kwargs)
Load vips from source
-
.vipsload_stream(stream : IO, **kwargs)
Load vips from stream
-
.webpload(filename : String, **kwargs)
Load webp from file
-
.webpload_buffer(buffer : Bytes, **kwargs)
Load webp from buffer
-
.webpload_source(source : Source, **kwargs)
Load webp from source
-
.webpload_stream(stream : IO, **kwargs)
Load webp from stream
-
.worley(width : Int32, height : Int32, **kwargs)
Make a worley noise image
-
.xyz(width : Int32, height : Int32, **kwargs)
Make an image where pixel values are coordinates
-
.zone(width : Int32, height : Int32, **kwargs)
Make a zone plate
Instance Method Summary
-
#!=(other)
Returns
true
if this object is not equal to other. - #%(other)
- #&(other)
- #*(other)
-
#**(exp : Image)
Raise to the power of an image
-
#**(exp : Array(Number))
Raise to the power of a constant or an array of constants
-
#**(*exp : Number)
Arc tangent of a constant or an array of constants in degrees
- #+(other)
- #-(other)
- #/(other)
- #<(other)
- #<<(other)
- #<=(other)
-
#==(other)
Returns
false
(other can only be aValue
here). - #>(other)
- #>=(other)
- #>>(other)
-
#[](x : Int32, y : Int32)
A synonym for
#getpoint
-
#[](i : Int32)
pull out band elements from an image
-
#[](index : Range)
Fetch bands using a range
- #^(other)
- #|(other)
-
#a_cosh : Image
Return the inverse hyperbolic cosine of an image in degrees.
-
#a_sinh : Image
Return the inverse hyperbolic sine of an image in degrees.
-
#a_tan2(x : Image)
Arc tangent of an image in degrees.
-
#a_tanh : Image
Return the inverse hyperbolic tangent of an image in degrees.
-
#abs
Absolute value of an image
-
#acos : Image
Return the inverse cosine of an image in degrees.
-
#add(right : Image)
Add two images
-
#add_alpha : Image
Append an alpha channel to an image.
-
#affine(matrix : Array(Float64), **kwargs)
Affine transform of an image
-
#asin : Image
Return the inverse sine of an image in degrees.
-
#atan : Image
Return the inverse tangent of an image in degrees.
-
#autorot
Autorotate image by exif tag
-
#avg
Find image average
-
#avifsave_stream(stream : IO, **kwargs)
Save image in avif format
-
#avifsave_target(target : Target, **kwargs)
Save image in avif format
-
#band_exists?(i : Int32)
Does band exist in image.
-
#bandand
AND the bands of an image together
-
#bandbool(boolean : Enums::OperationBoolean)
Boolean operation across image bands
-
#bandeor
EOR the bands of an image together
-
#bandfold(**kwargs)
Fold up x axis into bands
- #bandjoin(arr : Array(Int32)) : Image
- #bandjoin(arr : Array(Float64)) : Image
- #bandjoin(arr : Array(Image)) : Image
-
#bandjoin(*arr : Float64) : Image
Append a set of constants bandwise
-
#bandjoin(*arr : Int32) : Image
Append a set of constants bandwise
-
#bandjoin(*arr : Image) : Image
Append a set of images bandwise
-
#bandjoin(*arr : Image | Number) : Image
Append a set of mixed images and constants bandwise
-
#bandjoin_const(c : Array(Float64))
Append a constant band to an image
-
#bandmean
Band-wise average
-
#bandor
OR the bands of an image together
-
#bandrank(*vals : Float64, **kwargs)
Band-wise rank a set of constants.
-
#bandrank(*vals : Int32, **kwargs)
Band-wise rank a set of constants.
-
#bandrank(*vals : Image, **kwargs)
Band-wise rank a set of images.
-
#bandrank(*vals, **kwargs)
Band-wise rank a set of mixed images and constants.
-
#bands : Int32
Number of bands in image
-
#bandsplit : Array(Image)
Split an n-band image into n separate images.
-
#bandunfold(**kwargs)
Unfold image bands into x axis
-
#boolean(right : Image, boolean : Enums::OperationBoolean)
Boolean operation on two images
-
#boolean_const(boolean : Enums::OperationBoolean, c : Array(Float64))
Boolean operations against a constant
-
#buildlut
Build a look-up table
-
#byteswap
Byteswap an image
-
#cache(**kwargs)
Cache an image
-
#canny(**kwargs)
Canny edge detector
-
#case(*args : Float64) : Image
Use pixel values to pick cases from an array of constants
-
#case(*args : Int32) : Image
Use pixel values to pick cases from an array of constants
-
#case(*images : Image) : Image
Use pixel values to pick cases from an array of images.
-
#case(*args) : Image
Use pixel values to pick cases from an a set of mixed images and constants.
-
#cast(format : Enums::BandFormat, **kwargs)
Cast an image
-
#ceil : Image
Return the smallest integral value not less than the argument.
-
#cmc2lch
Transform lch to cmc
-
#cmyk2xyz
Transform cmyk to xyz
-
#coding : Enums::Coding
Pixel coding
-
#colourspace(space : Enums::Interpretation, **kwargs)
Convert to a new colorspace
-
#compass(mask : Image, **kwargs)
Convolve with rotating mask
-
#complex(cmplx : Enums::OperationComplex)
Perform a complex operation on an image
-
#complex2(right : Image, cmplx : Enums::OperationComplex2)
Complex binary operations on two images
-
#complexform(right : Image)
Form a complex image from two real images
-
#complexget(get : Enums::OperationComplexget)
Get a component from a complex image
-
#composite(images : Array(Image), modes : Array(Enums::BlendMode), **kwargs)
Blend an array of images with an array of blend modes
-
#composite(image : Image, mode : Enums::BlendMode, **kwargs)
A synonym for
#composite2
-
#composite2(overlay : Image, mode : Enums::BlendMode, **kwargs)
Blend a pair of images with a blend mode
-
#conj : Image
Return the complex conjugate of an image.
-
#contains(name : String)
Check if the underlying image contains an property of metadata.
-
#conv(mask : Image, **kwargs)
Convolution operation
-
#conva(mask : Image, **kwargs)
Approximate integer convolution
-
#convasep(mask : Image, **kwargs)
Approximate separable integer convolution
-
#convf(mask : Image)
Float convolution operation
-
#convi(mask : Image)
Int convolution operation
-
#convsep(mask : Image, **kwargs)
Seperable convolution operation
-
#copy(**kwargs)
Copy an image
-
#copy_memory
Copy an image to a memory area.
-
#cos : Image
Return the cosine of an image in degrees.
-
#cosh : Image
Return the hyperbolic cosine of an image in degrees.
-
#countlines(direction : Enums::Direction)
Count lines in an image
-
#crop(left : Int32, top : Int32, width : Int32, height : Int32)
A synonym for
#extract_area
-
#csvsave(filename : String, **kwargs)
Save image to csv
-
#csvsave_stream(stream : IO, **kwargs)
Save image to csv
-
#csvsave_target(target : Target, **kwargs)
Save image to csv
-
#de00(right : Image)
Calculate de00
-
#de76(right : Image)
Calculate de76
-
#decmc(right : Image)
Calculate decmc
-
#deviate
Find image standard deviation
-
#dilate(mask : Image)
Dilate with a structuring element.
-
#divide(right : Image)
Divide two images
-
#dzsave(filename : String, **kwargs)
Save image to deepzoom file
-
#dzsave_buffer(**kwargs)
Save image to dz buffer
-
#embed(x : Int32, y : Int32, width : Int32, height : Int32, **kwargs)
Embed an image in a larger image
-
#erode(mask : Image)
Erode with a structuring element.
-
#exp : Image
Returns e ** pixel
-
#exp10 : Image
Returns 10 ** pixel
-
#extract_area(left : Int32, top : Int32, width : Int32, height : Int32)
Extract an area from an image
-
#extract_band(band : Int32, **kwargs)
Extract band from an image
-
#falsecolour
False-color an image
-
#fastcor(ref : Image)
Fast correlation
-
#filename : String
Image filename
-
#fill_nearest
Fill image zeros with nearest non-zero pixel
-
#find_trim(**kwargs)
Search an image for non-edge areas
-
#fitssave(filename : String, **kwargs)
Save image to fits file
-
#flatten(**kwargs)
Flatten alpha out of an image
-
#flip(direction : Enums::Direction)
Flip an image
-
#fliphor
Flip horizontally
-
#flipver
Flip vertically
-
#float2rad
Transform float rgb to radiance coding
-
#floor : Image
Return the largest integral value not greater than the argument.
-
#format : Enums::BandFormat
Pixel format in image
-
#freqmult(mask : Image)
Frequency-domain filtering
-
#fwfft
Forward fft
-
#gamma(**kwargs)
Gamma an image
-
#gaussblur(sigma : Float64, **kwargs)
Gaussian blur
-
#get(name : String)
Get a metadata item from an image.
-
#get_fields
Get the names of all fields on an image.
-
#get_typeof(nam : String)
Get the GType of a GObject property
-
#getpoint(x : Int32, y : Int32)
Read a point from an image
-
#gifsave(filename : String, **kwargs)
Save as gif
-
#gifsave_buffer(**kwargs)
Save as gif
-
#gifsave_stream(stream : IO, **kwargs)
Save as gif
-
#gifsave_target(target : Target, **kwargs)
Save as gif
-
#globalbalance(**kwargs)
Global balance an image mosaic
-
#gravity(direction : Enums::CompassDirection, width : Int32, height : Int32, **kwargs)
Place an image within a larger image with a certain gravity
-
#grid(tile_height : Int32, across : Int32, down : Int32)
Grid an image
-
#has_alpha? : Bool
Does this image have an alpha channel?
-
#heifsave(filename : String, **kwargs)
Save image in heif format
-
#heifsave_buffer(**kwargs)
Save image in heif format
-
#heifsave_stream(stream : IO, **kwargs)
Save image in heif format
-
#heifsave_target(target : Target, **kwargs)
Save image in heif format
-
#height : Int32
Image height in pixels
-
#hist_cum
Form cumulative histogram
-
#hist_entropy
Estimate image entropy
-
#hist_equal(**kwargs)
Histogram equalisation
-
#hist_find(**kwargs)
Find image histogram
-
#hist_find_indexed(index : Image, **kwargs)
Find indexed image histogram
-
#hist_find_ndim(**kwargs)
Find n-dimensional image histogram
-
#hist_ismonotonic
Test for monotonicity
-
#hist_local(width : Int32, height : Int32, **kwargs)
Local histogram equalisation
-
#hist_match(ref : Image)
Match two histograms
-
#hist_norm
Normalise histogram
-
#hist_plot
Plot histogram
-
#hough_circle(**kwargs)
Find hough circle transform
-
#hough_line(**kwargs)
Find hough line transform
-
#hsv2srgb
Transform hsv to srgb
-
#icc_export(**kwargs)
Output to device with icc profile
-
#icc_import(**kwargs)
Import from device with icc profile
-
#icc_transform(output_profile : String, **kwargs)
Transform between devices with icc profiles
-
#ifthenelse(in1, in2, blend = false)
ifthenelse an image Select pixels from
th
ifself
is non-zero and fromel
ifself
is zero. -
#imag : Image
Return the imaginary part of a complex image.
-
#insert(sub : Image, x : Int32, y : Int32, **kwargs)
Insert image @sub into @main at @x, @y
-
#interpretation : Enums::Interpretation
Pixel interpretation
-
#invert
Invert an image
-
#invertlut(**kwargs)
Build an inverted look-up table
-
#invfft(**kwargs)
Inverse fft
-
#join(in2 : Image, direction : Enums::Direction, **kwargs)
Join a pair of images
-
#jp2ksave(filename : String, **kwargs)
Save image in jpeg2000 format
-
#jp2ksave_buffer(**kwargs)
Save image in jpeg2000 format
-
#jp2ksave_stream(stream : IO, **kwargs)
Save image in jpeg2000 format
-
#jp2ksave_target(target : Target, **kwargs)
Save image in jpeg2000 format
-
#jpegsave(filename : String, **kwargs)
Save image to jpeg file
-
#jpegsave_buffer(**kwargs)
Save image to jpeg buffer
-
#jpegsave_mime(**kwargs)
Save image to jpeg mime
-
#jpegsave_stream(stream : IO, **kwargs)
Save image to jpeg stream
-
#jpegsave_target(target : Target, **kwargs)
Save image to jpeg target
-
#jxlsave(filename : String, **kwargs)
Save image in jpeg-xl format
-
#jxlsave_buffer(**kwargs)
Save image in jpeg-xl format
-
#jxlsave_stream(stream : IO, **kwargs)
Save image in jpeg-xl format
-
#jxlsave_target(target : Target, **kwargs)
Save image in jpeg-xl format
-
#killed?
If image has been killed see
#set_kill
, set an error message, clear thekill
flag and return true. -
#lab2labq
Transform float lab to labq coding
-
#lab2labs
Transform float lab to signed short
-
#lab2lch
Transform lab to lch
-
#lab2xyz(**kwargs)
Transform cielab to xyz
-
#labelregions
Label regions in an image
-
#labq2lab
Unpack a labq image to float lab
-
#labq2labs
Unpack a labq image to short lab
-
#labq2srgb
Convert a labq image to srgb
-
#labs2lab
Transform signed short lab to float
-
#labs2labq
Transform short lab to labq coding
-
#lch2cmc
Transform lch to cmc
-
#lch2lab
Transform lch to lab
-
#linear(a : Array(Float64), b : Array(Float64), **kwargs)
Calculate (a * in + b)
-
#linecache(**kwargs)
Cache an image as a set of lines
-
#log : Image
Return the natural log of an image
-
#log10 : Image
Return the log base 10 of an image
-
#magicksave(filename : String, **kwargs)
Save file with imagemagick
-
#magicksave_bmp(filename : String, **kwargs)
Save bmp image with imagemagick
-
#magicksave_bmp_buffer(**kwargs)
Save bmp image to magick buffer
-
#magicksave_buffer(**kwargs)
Save image to magick buffer
-
#magicksave_gif(filename : String, **kwargs)
Save gif image with imagemagick
-
#magicksave_gif_buffer(**kwargs)
Save gif image to magick buffer
-
#mapim(index : Image, **kwargs)
Resample with a map image
-
#maplut(lut : Image, **kwargs)
Map an image though a lut
-
#match(sec : Image, xr1 : Int32, yr1 : Int32, xs1 : Int32, ys1 : Int32, xr2 : Int32, yr2 : Int32, xs2 : Int32, ys2 : Int32, **kwargs)
First-order match of two images
-
#math(math : Enums::OperationMath)
Apply a math operation to an image
-
#math2(right : Image, math2 : Enums::OperationMath2)
Binary math operations
-
#math2_const(math2 : Enums::OperationMath2, c : Array(Float64))
Binary math operations with a constant
-
#matrixinvert
Invert an matrix
-
#matrixprint(**kwargs)
Print matrix
-
#matrixsave(filename : String, **kwargs)
Save image to matrix
-
#matrixsave_stream(stream : IO, **kwargs)
Save image to matrix
-
#matrixsave_target(target : Target, **kwargs)
Save image to matrix
-
#max(**kwargs)
Find image maximum
-
#maxpos
Return the coordinates of the image maximum.
-
#measure(h : Int32, v : Int32, **kwargs)
Measure a set of patches on a color chart
-
#median(size = 3)
size x size median filter.
-
#merge(sec : Image, direction : Enums::Direction, dx : Int32, dy : Int32, **kwargs)
Merge two images
-
#min(**kwargs)
Find image minimum
-
#minpos
Return the coordinates of the image minimum.
-
#morph(mask : Image, morph : Enums::OperationMorphology)
Morphology operation
-
#mosaic(sec : Image, direction : Enums::Direction, xref : Int32, yref : Int32, xsec : Int32, ysec : Int32, **kwargs)
Mosaic two images
-
#mosaic1(sec : Image, direction : Enums::Direction, xr1 : Int32, yr1 : Int32, xs1 : Int32, ys1 : Int32, xr2 : Int32, yr2 : Int32, xs2 : Int32, ys2 : Int32, **kwargs)
First-order mosaic of two images
-
#msb(**kwargs)
Pick most-significant byte from an image
-
#multiply(right : Image)
Multiply two images
-
#mutate(&)
Mutate an image with a block.
-
#new_from_image(value)
A new image is created with the same width, height, format, interpretation, resolution and offset as self, but with every pixel set to the specified value.
-
#new_from_image(*value : Int32 | Float64)
A new image is created with the same width, height, format, interpretation, resolution and offset as self, but with every pixel set to the specified value.
- #offset
-
#page_height : Int32
Multi-page images can have a page height.
-
#pbmsave_stream(stream : IO, **kwargs)
Save image in pbm format
-
#pbmsave_target(target : Target, **kwargs)
Save image in pbm format
-
#percent(percent : Float64)
Find threshold for percent of pixels
-
#pfmsave_stream(stream : IO, **kwargs)
Save image in pfm format
-
#pfmsave_target(target : Target, **kwargs)
Save image in pfm format
-
#pgmsave_stream(stream : IO, **kwargs)
Save image in pgm format
-
#pgmsave_target(target : Target, **kwargs)
Save image in pgm format
-
#phasecor(in2 : Image)
Calculate phase correlation
-
#pngsave(filename : String, **kwargs)
Save image to png file
-
#pngsave_buffer(**kwargs)
Save image to png buffer
-
#pngsave_stream(stream : IO, **kwargs)
Save image to stream as png
-
#pngsave_target(target : Target, **kwargs)
Save image to target as png
-
#polar : Image
Return an image converted to polar coordinates.
-
#ppmsave(filename : String, **kwargs)
Save image to ppm file
-
#ppmsave_stream(stream : IO, **kwargs)
Save to ppm
-
#ppmsave_target(target : Target, **kwargs)
Save to ppm
-
#premultiply(**kwargs)
Premultiply image alpha
-
#profile
Find image profiles
-
#project
Find image projections
-
#quadratic(coeff : Image, **kwargs)
Resample an image with a quadratic transform
-
#rad2float
Unpack radiance coding to float rgb
-
#radsave(filename : String, **kwargs)
Save image to radiance file
-
#radsave_buffer(**kwargs)
Save image to radiance buffer
-
#radsave_stream(stream : IO, **kwargs)
Save image to radiance stream
-
#radsave_target(target : Target, **kwargs)
Save image to radiance target
-
#rank(width : Int32, height : Int32, index : Int32)
Rank filter
-
#rawsave(filename : String, **kwargs)
Save image to raw file
-
#rawsave_fd(fd : Int32, **kwargs)
Write raw image to file descriptor
-
#real : Image
Return the real part of a complex image.
-
#recomb(m : Image)
Linear recombination with matrix
-
#rect : Image
Return an image converted to rectangular coordinates.
-
#reduce(hshrink : Float64, vshrink : Float64, **kwargs)
Reduce an image
-
#reduceh(hshrink : Float64, **kwargs)
Shrink an image horizontally
-
#reducev(vshrink : Float64, **kwargs)
Shrink an image vertically
-
#relational(right : Image, relational : Enums::OperationRelational)
Relational operation on two images
-
#relational_const(relational : Enums::OperationRelational, c : Array(Float64))
Relational operations against a constant
-
#remainder(right : Image)
Remainder after integer division of two images
-
#remainder_const(c : Array(Float64))
Remainder after integer division of an image and a constant
-
#replicate(across : Int32, down : Int32)
Replicate an image
-
#resize(scale : Float64, **kwargs)
Resize an image
-
#rint : Image
Return the nearest integral value.
-
#rot(angle : Enums::Angle)
Rotate an image
-
#rot180
Rotate 180 degrees clockwise.
-
#rot270
Rotate 270 degrees clockwise.
-
#rot45(**kwargs)
Rotate an image
-
#rot90
Rotate 90 degrees clockwise.
-
#rotate(angle : Float64, **kwargs)
Rotate an image by a number of degrees
-
#round(round : Enums::OperationRound)
Perform a round function on an image
- #scale
-
#scaleimage(**opts)
Scale an image to 0 - 255.
-
#scrgb2bw(**kwargs)
Convert scrgb to bw
-
#scrgb2srgb(**kwargs)
Convert an scrgb image to srgb
-
#scrgb2xyz
Transform scrgb to xyz
-
#sequential(**kwargs)
Check sequential access
-
#set_kill(kill : Bool)
Set the
kill
flag on an image. -
#set_progress(enable : Bool)
Enable progress reporting on an image.
-
#set_progress(&block : Int32 -> Nil)
Enable progress reporting on an image and provide a block which will be executed on feedback.
-
#sharpen(**kwargs)
Unsharp masking for print
-
#shrink(hshrink : Float64, vshrink : Float64)
Shrink an image
-
#shrinkh(hshrink : Int32)
Shrink an image horizontally
-
#shrinkv(vshrink : Int32)
Shrink an image vertically
-
#sign
Unit vector of pixel
-
#signal_connect(signal : Enums::Signal, data : Pointer(Void) = Pointer(Void).null, &callback : EvalProc)
Connects a
EvalProc
callback to a signal on this image. -
#similarity(**kwargs)
Similarity transform of an image
-
#sin : Image
Return the sine of an image in degrees.
-
#sinh : Image
Return the hyperbolic sine of an image in degrees.
-
#size
Get the image size
-
#smartcrop(width : Int32, height : Int32, **kwargs)
Extract an area from an image
-
#sobel
Sobel edge detector
-
#spcor(ref : Image)
Spatial correlation
-
#spectrum
Make displayable power spectrum
-
#srgb2hsv
Transform srgb to hsv
-
#srgb2scrgb
Convert an srgb image to scrgb
-
#stats
Find many image stats
-
#stdif(width : Int32, height : Int32, **kwargs)
Statistical difference
-
#subsample(xfac : Int32, yfac : Int32, **kwargs)
Subsample an image
-
#subtract(right : Image)
Subtract two images
-
#tan : Image
Return the tangent of an image in degrees.
-
#tanh : Image
Return the hyperbolic tangent of an image in degrees.
-
#thumbnail_image(width : Int32, **kwargs)
Generate thumbnail from image
-
#tiffsave(filename : String, **kwargs)
Save image to tiff file
-
#tiffsave_buffer(**kwargs)
Save image to tiff buffer
-
#tilecache(**kwargs)
Cache an image as a set of tiles
-
#to_s(io : IO)
Appends a short String representation of this object which includes its class name and its object address.
-
#transpose3d(**kwargs)
Transpose3d an image
-
#unpremultiply(**kwargs)
Unpremultiply image alpha
-
#vipssave(filename : String, **kwargs)
Save image to file in vips format
-
#vipssave_stream(stream : IO, **kwargs)
Save image to stream in vips format
-
#vipssave_target(target : Target, **kwargs)
Save image to target in vips format
-
#webpsave(filename : String, **kwargs)
Save image to webp file
-
#webpsave_buffer(**kwargs)
Save image to webp buffer
-
#webpsave_stream(stream : IO, **kwargs)
Save image to webp stream
-
#webpsave_target(target : Target, **kwargs)
Save image to webp target
-
#width : Int32
Image width in pixels
-
#wrap(**kwargs)
Wrap image origin
-
#write(other : Image)
Write an image to another image.
-
#write_to_buffer(format : String, **kwargs)
Write this image to a memory buffer.
-
#write_to_bytes : Bytes
Write the image to a
Bytes
. -
#write_to_file(name : String, **kwargs)
Write this image to a file.
-
#write_to_memory : Tuple(Pointer(Void), LibC::SizeT)
Write the image to memory as a simple, unformatted C-style array.
-
#write_to_target(stream : IO, format : String, **kwargs)
Write an image to a stream.
-
#write_to_target(target : Target, format : String, **kwargs)
Write an image to a target.
-
#xoffset : Int32
Horizontal offset of origin
-
#xres : Float64
Horizontal resolution in pixels/mm
-
#xyz2cmyk
Transform xyz to cmyk
-
#xyz2lab(**kwargs)
Transform xyz to lab
-
#xyz2scrgb
Transform xyz to scrgb
-
#xyz2yxy
Transform xyz to yxy
-
#yoffset : Int32
Vertical offset of origin
-
#yres : Float64
Vertical resolution in pixels/mm
-
#yxy2xyz
Transform yxy to xyz
-
#zoom(xfac : Int32, yfac : Int32)
Zoom an image
Instance methods inherited from class Vips::VipsObject
get(name : String)
get,
get_blurb(name : String)
get_blurb,
get_description
get_description,
get_pspec(name : String) : LibVips::GParamSpec | Nil
get_pspec,
get_typeof(name : String)
get_typeof,
post_close(&block : -> )
post_close,
print_all
print_all,
set(gtype, name, value)set(options : String) set
Instance methods inherited from class Vips::GObject
get(name : String, gval : GValue)
get,
object_ref
object_ref,
ref_count
ref_count,
release_handle
release_handle,
set(name : String, gval : GValue)
set,
signal_connect(signal : String, callback : Proc, data : Pointer(Void) = Pointer(Void).null) : LibVips::Gulong
signal_connect,
signal_disconnect(handler_id : LibVips::Gulong)signal_disconnect(func : Proc, data : Pointer(Void) = Pointer(Void).null)
signal_disconnect(data : LibVips::Gpointer) signal_disconnect
Constructor Detail
expand a constant into an image
Create a new Image from a 1D or 2D array. A 1D array becomes an
image with height 1. Use #scale
and #offset
to set the scale and
offset fields in the header. These are useful for integer
convolutions.
For example:
image = Vips::Image.new_from_array [1, 2, 3]
or
image = Vips::Image.new_from_array [
[-1, -1, -1],
[-1, 16, -1],
[-1, -1, -1],
], 8
for a simple sharpening mask.
Create a new Image
for an image encoded in a format such as
JPEG in a binary String
, Bytes
or IO
. Load options may be passed as
strings or appended as a keyword arguments. For example:
image = Vips::Image.new_from_buffer memory_buffer, "shrink=2"
or alternatively:
image = Vips::Image.new_from_buffer memory_buffer, "", shrink: 2
The options available depend on the file format. Try something like:
$ vips jpegload_buffer
at the command-line to see the available options. Not all loaders support load from buffer, but at least JPEG, PNG and TIFF images will work.
Loading is fast: only enough of the image is loaded to be able to fill out the header. Pixels will only be decompressed when they are needed.
Return a new Image
for a file on disc. This method can load
images in any format supported by vips. The filename can include
load options, for example:
image = Vips::Image.new_from_file "fred.jpg[shrink=2]"
You can also supply options as keyword arguments (NamedTuple), for example:
image = Vips::Image.new_from_file "fred.jpg", shrink: 2
The full set of options available depend upon the load operation that will be executed. Try something like:
$ vips jpegload
at the command-line to see a summary of the available options for the JPEG loader.
Loading is fast: only enough of the image is loaded to be able to fill out the header. Pixels will only be decompressed when they are needed.
Wraps an Image around an area of memory containing a C-style array. For
example, if the data
memory array contains four bytes with the
values 1, 2, 3, 4, you can make a one-band, 2x2 uchar image from
it like this:
image = Image.new_from_memory(data, 2, 2, 1, Enums::BandFormat::Uchar)
A reference is kept to the data object, so it will not be garbage-collected until the returned image is garbage-collected.
This method is useful for efficiently transferring images from GDI+ into libvips.
Create a new Image
from memory and copies the memory area. See
.new_from_memory
for a version of this method which does not copy the
memory area.
Create a new Image
from a source. Load options may be passed as
strings or appended as a hash. For example:
source = Vips::Source.new_from_file("k2.jpg")
image = Vips::Image.new_from_source source, "shrink=2"
or alternatively:
image = Vips::Image.new_from_source source, shrink: 2
The options available depend on the file format. Try something like:
$ vips jpegload_source
at the command-line to see the available options. Not all loaders support load from source, but at least JPEG, PNG and TIFF images will work.
Loading is fast: only enough data is read to be able to fill out the header. Pixels will only be read and decompressed when they are needed.
Load a formatted image from a stream
This behaves exactly as .new_from_source
, but the image is loaded from a stream rathar than from a source.
Note: AT least libvips 8.9 is needed
Make a new temporary image.
Returns an image backed by a temporary file. When written to with #write
, a temporary
file will be created on disc in the specified format. When the image is closed, the file will be deleted
automatically.
The file is created in the temporary directory. This is set with the environment variable TMPDIR
.
If this is not set, then on Unix systems, vips will default to /tmp
. On Windows, vips uses
GetTempPath()
to find the temporary director.
vips uses g_mkstemp()
to make the temporary filename. They generally look something like vips-12-EJKFGH.v
format is the format for the temp file, for example %s.v
for a vips format file. The %s
is
subsituted by the file path.
Note: VipsException
is raised, if unable to make temp file from format
Class Method Detail
Load an analyze6 image
# out_, flags = Vips::Image.analyzeload(filename, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Join an array of images
# out_ = Vips::Image.arrayjoin(in_, {across: Int32, shim: Int32, background: Array(Float64), halign: Enums::Align, valign: Enums::Align, hspacing: Int32, vspacing: Int32})
Input Parameters
Required
in : Array(Image) - Array of input images
Optionals
across : Int32 - Number of images across grid
shim : Int32 - Pixels between images
background : Array(Float64) - Colour for new pixels
halign : Enums::Align - Align on the left, centre or right
valign : Enums::Align - Align on the top, centre or bottom
hspacing : Int32 - Horizontal spacing between images
vspacing : Int32 - Vertical spacing between images
Returns
Output image
Make a black image
# out_ = Vips::Image.black(width, height, {bands: Int32})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
Optionals
bands : Int32 - Number of bands in image
Returns
Output image
Load csv
# out_, flags = Vips::Image.csvload(filename, {skip: Int32, lines: Int32, whitespace: String, separator: String, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
skip : Int32 - Skip this many lines at the start of the file
lines : Int32 - Read this many lines from the file
whitespace : String - Set of whitespace characters
separator : String - Set of separator characters
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load csv
# out_, flags = Vips::Image.csvload_source(source, {skip: Int32, lines: Int32, whitespace: String, separator: String, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
skip : Int32 - Skip this many lines at the start of the file
lines : Int32 - Read this many lines from the file
whitespace : String - Set of whitespace characters
separator : String - Set of separator characters
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load csv
# out_, flags = Vips::Image.csvload_stream(stream, {skip: Int32, lines: Int32, whitespace: String, separator: String, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
skip : Int32 - Skip this many lines at the start of the file
lines : Int32 - Read this many lines from the file
whitespace : String - Set of whitespace characters
separator : String - Set of separator characters
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Make an image showing the eye's spatial response
# out_ = Vips::Image.eye(width, height, {uchar: Bool, factor: Float64})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
Optionals
uchar : Bool - Output an unsigned char image
factor : Float64 - Maximum spatial frequency
Returns
Output image
Find the name of the load operation vips will use to load a file.
For example "VipsForeignLoadJpegFile". You can use this to work out what
options to pass to .new_from_file
Find the name of the load operation vips will use to load a buffer.
For example "VipsForeignLoadJpegBuffer". You can use this to work out what
options to pass to .new_from_buffer
Find the name of the load operation vips will use to load a buffer.
For example "VipsForeignLoadJpegBuffer". You can use this to work out what
options to pass to .new_from_buffer
Find the name of the load operation vips will use to load a source.
For example "VipsForeignLoadJpegSource". You can use this to work out what
options to pass to .new_from_source
Find the name of the load operation vips will use to load a stream.
For example "VipsForeignLoadJpegSource". You can use this to work out what
options to pass to .new_from_stream
Load a fits image
# out_, flags = Vips::Image.fitsload(filename, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load fits from a source
# out_, flags = Vips::Image.fitsload_source(source, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load fits from a stream
# out_, flags = Vips::Image.fitsload_stream(stream, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Make a fractal surface
# out_ = Vips::Image.fractsurf(width, height, fractal_dimension)
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
fractal_dimension : Float64 - Fractal dimension
Returns
Output image
Make a gaussian image
# out_ = Vips::Image.gaussmat(sigma, min_ampl, {separable: Bool, precision: Enums::Precision})
Input Parameters
Required
sigma : Float64 - Sigma of Gaussian
min_ampl : Float64 - Minimum amplitude of Gaussian
Optionals
separable : Bool - Generate separable Gaussian
precision : Enums::Precision - Generate with this precision
Returns
Output image
Make a gaussnoise image
# out_ = Vips::Image.gaussnoise(width, height, {sigma: Float64, mean: Float64, seed: Int32})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
Optionals
sigma : Float64 - Standard deviation of pixels in generated image
mean : Float64 - Mean of pixels in generated image
seed : Int32 - Random number seed
Returns
Output image
Load gif with libnsgif
# out_, flags = Vips::Image.gifload(filename, {n: Int32, page: Int32, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
n : Int32 - Load this many pages
page : Int32 - Load this page from the file
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load gif with libnsgif
# out_, flags = Vips::Image.gifload_buffer(buffer, {n: Int32, page: Int32, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
buffer : Bytes - Buffer to load from
Optionals
n : Int32 - Load this many pages
page : Int32 - Load this page from the file
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load gif from source
# out_, flags = Vips::Image.gifload_source(source, {n: Int32, page: Int32, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
n : Int32 - Load this many pages
page : Int32 - Load this page from the file
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load gif from stream
# out_, flags = Vips::Image.gifload_stream(stream, {n: Int32, page: Int32, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
n : Int32 - Load this many pages
page : Int32 - Load this page from the file
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Make a grey ramp image
# out_ = Vips::Image.grey(width, height, {uchar: Bool})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
Optionals
uchar : Bool - Output an unsigned char image
Returns
Output image
Load a heif image
# out_, flags = Vips::Image.heifload(filename, {page: Int32, n: Int32, thumbnail: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
page : Int32 - Load this page from the file
n : Int32 - Load this many pages
thumbnail : Bool - Fetch thumbnail image
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load a heif image
# out_, flags = Vips::Image.heifload_buffer(buffer, {page: Int32, n: Int32, thumbnail: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
buffer : Bytes - Buffer to load from
Optionals
page : Int32 - Load this page from the file
n : Int32 - Load this many pages
thumbnail : Bool - Fetch thumbnail image
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load a heif image
# out_, flags = Vips::Image.heifload_source(source, {page: Int32, n: Int32, thumbnail: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
page : Int32 - Load this page from the file
n : Int32 - Load this many pages
thumbnail : Bool - Fetch thumbnail image
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load a heif image
# out_, flags = Vips::Image.heifload_stream(stream, {page: Int32, n: Int32, thumbnail: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
page : Int32 - Load this page from the file
n : Int32 - Load this many pages
thumbnail : Bool - Fetch thumbnail image
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Make a 1d image where pixel values are indexes
# out_ = Vips::Image.identity({bands: Int32, ushort: Bool, size: Int32})
Input Parameters
Optionals
bands : Int32 - Number of bands in LUT
ushort : Bool - Create a 16-bit LUT
size : Int32 - Size of 16-bit LUT
Returns
Output image
Load jpeg2000 image
# out_, flags = Vips::Image.jp2kload(filename, {page: Int32, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
page : Int32 - Load this page from the image
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load jpeg2000 image
# out_, flags = Vips::Image.jp2kload_buffer(buffer, {page: Int32, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
buffer : Bytes - Buffer to load from
Optionals
page : Int32 - Load this page from the image
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load jpeg2000 image
# out_, flags = Vips::Image.jp2kload_source(source, {page: Int32, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
page : Int32 - Load this page from the image
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load jpeg2000 image
# out_, flags = Vips::Image.jp2kload_stream(stream, {page: Int32, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
page : Int32 - Load this page from the image
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load jpeg from file
# out_, flags = Vips::Image.jpegload(filename, {shrink: Int32, autorotate: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
shrink : Int32 - Shrink factor on load
autorotate : Bool - Rotate image using exif orientation
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load jpeg from buffer
# out_, flags = Vips::Image.jpegload_buffer(buffer, {shrink: Int32, autorotate: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
buffer : Bytes - Buffer to load from
Optionals
shrink : Int32 - Shrink factor on load
autorotate : Bool - Rotate image using exif orientation
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load image from jpeg source
# out_, flags = Vips::Image.jpegload_source(source, {shrink: Int32, autorotate: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
shrink : Int32 - Shrink factor on load
autorotate : Bool - Rotate image using exif orientation
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load image from jpeg stream
# out_, flags = Vips::Image.jpegload_stream(stream, {shrink: Int32, autorotate: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
shrink : Int32 - Shrink factor on load
autorotate : Bool - Rotate image using exif orientation
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load jpeg-xl image
# out_, flags = Vips::Image.jxlload(filename, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load jpeg-xl image
# out_, flags = Vips::Image.jxlload_buffer(buffer, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
buffer : Bytes - Buffer to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load jpeg-xl image
# out_, flags = Vips::Image.jxlload_source(source, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load jpeg-xl image
# out_, flags = Vips::Image.jxlload_stream(stream, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Make a laplacian of gaussian image
# out_ = Vips::Image.logmat(sigma, min_ampl, {separable: Bool, precision: Enums::Precision})
Input Parameters
Required
sigma : Float64 - Radius of Gaussian
min_ampl : Float64 - Minimum amplitude of Gaussian
Optionals
separable : Bool - Generate separable Gaussian
precision : Enums::Precision - Generate with this precision
Returns
Output image
Load file with imagemagick7
# out_, flags = Vips::Image.magickload(filename, {density: String, page: Int32, n: Int32, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
density : String - Canvas resolution for rendering vector formats like SVG
page : Int32 - Load this page from the file
n : Int32 - Load this many pages
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load buffer with imagemagick7
# out_, flags = Vips::Image.magickload_buffer(buffer, {density: String, page: Int32, n: Int32, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
buffer : Bytes - Buffer to load from
Optionals
density : String - Canvas resolution for rendering vector formats like SVG
page : Int32 - Load this page from the file
n : Int32 - Load this many pages
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Make a butterworth filter
# out_ = Vips::Image.mask_butterworth(width, height, order, frequency_cutoff, amplitude_cutoff, {uchar: Bool, nodc: Bool, reject: Bool, optical: Bool})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
order : Float64 - Filter order
frequency_cutoff : Float64 - Frequency cutoff
amplitude_cutoff : Float64 - Amplitude cutoff
Optionals
uchar : Bool - Output an unsigned char image
nodc : Bool - Remove DC component
reject : Bool - Invert the sense of the filter
optical : Bool - Rotate quadrants to optical space
Returns
Output image
Make a butterworth_band filter
# out_ = Vips::Image.mask_butterworth_band(width, height, order, frequency_cutoff_x, frequency_cutoff_y, radius, amplitude_cutoff, {uchar: Bool, nodc: Bool, reject: Bool, optical: Bool})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
order : Float64 - Filter order
frequency_cutoff_x : Float64 - Frequency cutoff x
frequency_cutoff_y : Float64 - Frequency cutoff y
radius : Float64 - radius of circle
amplitude_cutoff : Float64 - Amplitude cutoff
Optionals
uchar : Bool - Output an unsigned char image
nodc : Bool - Remove DC component
reject : Bool - Invert the sense of the filter
optical : Bool - Rotate quadrants to optical space
Returns
Output image
Make a butterworth ring filter
# out_ = Vips::Image.mask_butterworth_ring(width, height, order, frequency_cutoff, amplitude_cutoff, ringwidth, {uchar: Bool, nodc: Bool, reject: Bool, optical: Bool})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
order : Float64 - Filter order
frequency_cutoff : Float64 - Frequency cutoff
amplitude_cutoff : Float64 - Amplitude cutoff
ringwidth : Float64 - Ringwidth
Optionals
uchar : Bool - Output an unsigned char image
nodc : Bool - Remove DC component
reject : Bool - Invert the sense of the filter
optical : Bool - Rotate quadrants to optical space
Returns
Output image
Make fractal filter
# out_ = Vips::Image.mask_fractal(width, height, fractal_dimension, {uchar: Bool, nodc: Bool, reject: Bool, optical: Bool})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
fractal_dimension : Float64 - Fractal dimension
Optionals
uchar : Bool - Output an unsigned char image
nodc : Bool - Remove DC component
reject : Bool - Invert the sense of the filter
optical : Bool - Rotate quadrants to optical space
Returns
Output image
Make a gaussian filter
# out_ = Vips::Image.mask_gaussian(width, height, frequency_cutoff, amplitude_cutoff, {uchar: Bool, nodc: Bool, reject: Bool, optical: Bool})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
frequency_cutoff : Float64 - Frequency cutoff
amplitude_cutoff : Float64 - Amplitude cutoff
Optionals
uchar : Bool - Output an unsigned char image
nodc : Bool - Remove DC component
reject : Bool - Invert the sense of the filter
optical : Bool - Rotate quadrants to optical space
Returns
Output image
Make a gaussian filter
# out_ = Vips::Image.mask_gaussian_band(width, height, frequency_cutoff_x, frequency_cutoff_y, radius, amplitude_cutoff, {uchar: Bool, nodc: Bool, reject: Bool, optical: Bool})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
frequency_cutoff_x : Float64 - Frequency cutoff x
frequency_cutoff_y : Float64 - Frequency cutoff y
radius : Float64 - radius of circle
amplitude_cutoff : Float64 - Amplitude cutoff
Optionals
uchar : Bool - Output an unsigned char image
nodc : Bool - Remove DC component
reject : Bool - Invert the sense of the filter
optical : Bool - Rotate quadrants to optical space
Returns
Output image
Make a gaussian ring filter
# out_ = Vips::Image.mask_gaussian_ring(width, height, frequency_cutoff, amplitude_cutoff, ringwidth, {uchar: Bool, nodc: Bool, reject: Bool, optical: Bool})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
frequency_cutoff : Float64 - Frequency cutoff
amplitude_cutoff : Float64 - Amplitude cutoff
ringwidth : Float64 - Ringwidth
Optionals
uchar : Bool - Output an unsigned char image
nodc : Bool - Remove DC component
reject : Bool - Invert the sense of the filter
optical : Bool - Rotate quadrants to optical space
Returns
Output image
Make an ideal filter
# out_ = Vips::Image.mask_ideal(width, height, frequency_cutoff, {uchar: Bool, nodc: Bool, reject: Bool, optical: Bool})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
frequency_cutoff : Float64 - Frequency cutoff
Optionals
uchar : Bool - Output an unsigned char image
nodc : Bool - Remove DC component
reject : Bool - Invert the sense of the filter
optical : Bool - Rotate quadrants to optical space
Returns
Output image
Make an ideal band filter
# out_ = Vips::Image.mask_ideal_band(width, height, frequency_cutoff_x, frequency_cutoff_y, radius, {uchar: Bool, nodc: Bool, reject: Bool, optical: Bool})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
frequency_cutoff_x : Float64 - Frequency cutoff x
frequency_cutoff_y : Float64 - Frequency cutoff y
radius : Float64 - radius of circle
Optionals
uchar : Bool - Output an unsigned char image
nodc : Bool - Remove DC component
reject : Bool - Invert the sense of the filter
optical : Bool - Rotate quadrants to optical space
Returns
Output image
Make an ideal ring filter
# out_ = Vips::Image.mask_ideal_ring(width, height, frequency_cutoff, ringwidth, {uchar: Bool, nodc: Bool, reject: Bool, optical: Bool})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
frequency_cutoff : Float64 - Frequency cutoff
ringwidth : Float64 - Ringwidth
Optionals
uchar : Bool - Output an unsigned char image
nodc : Bool - Remove DC component
reject : Bool - Invert the sense of the filter
optical : Bool - Rotate quadrants to optical space
Returns
Output image
Load mat from file
# out_, flags = Vips::Image.matload(filename, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load matrix
# out_, flags = Vips::Image.matrixload(filename, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load matrix
# out_, flags = Vips::Image.matrixload_source(source, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load matrix
# out_, flags = Vips::Image.matrixload_stream(stream, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load an openexr image
# out_, flags = Vips::Image.openexrload(filename, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load file with openslide
# out_, flags = Vips::Image.openslideload(filename, {attach_associated: Bool, level: Int32, autocrop: Bool, associated: String, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
attach_associated : Bool - Attach all associated images
level : Int32 - Load this level from the file
autocrop : Bool - Crop to image bounds
associated : String - Load this associated image
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load source with openslide
# out_, flags = Vips::Image.openslideload_source(source, {attach_associated: Bool, level: Int32, autocrop: Bool, associated: String, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
attach_associated : Bool - Attach all associated images
level : Int32 - Load this level from the file
autocrop : Bool - Crop to image bounds
associated : String - Load this associated image
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load stream with openslide
# out_, flags = Vips::Image.openslideload_stream(stream, {attach_associated: Bool, level: Int32, autocrop: Bool, associated: String, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
attach_associated : Bool - Attach all associated images
level : Int32 - Load this level from the file
autocrop : Bool - Crop to image bounds
associated : String - Load this associated image
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load pdf from file
# out_, flags = Vips::Image.pdfload(filename, {page: Int32, n: Int32, dpi: Float64, scale: Float64, background: Array(Float64), memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
page : Int32 - Load this page from the file
n : Int32 - Load this many pages
dpi : Float64 - Render at this DPI
scale : Float64 - Scale output by this factor
background : Array(Float64) - Background value
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load pdf from buffer
# out_, flags = Vips::Image.pdfload_buffer(buffer, {page: Int32, n: Int32, dpi: Float64, scale: Float64, background: Array(Float64), memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
buffer : Bytes - Buffer to load from
Optionals
page : Int32 - Load this page from the file
n : Int32 - Load this many pages
dpi : Float64 - Render at this DPI
scale : Float64 - Scale output by this factor
background : Array(Float64) - Background value
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load pdf from source
# out_, flags = Vips::Image.pdfload_source(source, {page: Int32, n: Int32, dpi: Float64, scale: Float64, background: Array(Float64), memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
page : Int32 - Load this page from the file
n : Int32 - Load this many pages
dpi : Float64 - Render at this DPI
scale : Float64 - Scale output by this factor
background : Array(Float64) - Background value
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load pdf from stream
# out_, flags = Vips::Image.pdfload_stream(stream, {page: Int32, n: Int32, dpi: Float64, scale: Float64, background: Array(Float64), memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
page : Int32 - Load this page from the file
n : Int32 - Load this many pages
dpi : Float64 - Render at this DPI
scale : Float64 - Scale output by this factor
background : Array(Float64) - Background value
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Make a perlin noise image
# out_ = Vips::Image.perlin(width, height, {cell_size: Int32, uchar: Bool, seed: Int32})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
Optionals
cell_size : Int32 - Size of Perlin cells
uchar : Bool - Output an unsigned char image
seed : Int32 - Random number seed
Returns
Output image
Load png from file
# out_, flags = Vips::Image.pngload(filename, {unlimited: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
unlimited : Bool - Remove all denial of service limits
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load png from buffer
# out_, flags = Vips::Image.pngload_buffer(buffer, {unlimited: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
buffer : Bytes - Buffer to load from
Optionals
unlimited : Bool - Remove all denial of service limits
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load png from source
# out_, flags = Vips::Image.pngload_source(source, {unlimited: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
unlimited : Bool - Remove all denial of service limits
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load png from stream
# out_, flags = Vips::Image.pngload_stream(stream, {unlimited: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
unlimited : Bool - Remove all denial of service limits
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load ppm from file
# out_, flags = Vips::Image.ppmload(filename, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load ppm base class
# out_, flags = Vips::Image.ppmload_source(source, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load ppm base class
# out_, flags = Vips::Image.ppmload_stream(stream, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load named icc profile
# profile = Vips::Image.profile_load(name)
Input Parameters
Required
name : String - Profile name
Returns
Loaded profile
Load a radiance image from a file
# out_, flags = Vips::Image.radload(filename, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load rad from buffer
# out_, flags = Vips::Image.radload_buffer(buffer, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
buffer : Bytes - Buffer to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load rad from source
# out_, flags = Vips::Image.radload_source(source, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load rad from stream
# out_, flags = Vips::Image.radload_stream(stream, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load raw data from a file
# out_, flags = Vips::Image.rawload(filename, width, height, bands, {offset: UInt32, format: Enums::BandFormat, interpretation: Enums::Interpretation, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
bands : Int32 - Number of bands in image
Optionals
offset : UInt32 - Offset in bytes from start of file
format : Enums::BandFormat - Pixel format in image
interpretation : Enums::Interpretation - Pixel interpretation
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
run a complex operation on a complex image, or an image with an even number of bands ... handy for things like running .polar on .index images
Make a 2d sine wave
# out_ = Vips::Image.sines(width, height, {uchar: Bool, hfreq: Float64, vfreq: Float64})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
Optionals
uchar : Bool - Output an unsigned char image
hfreq : Float64 - Horizontal spatial frequency
vfreq : Float64 - Vertical spatial frequency
Returns
Output image
Sum an array of images
# out_ = Vips::Image.sum(in_)
Input Parameters
Required
in : Array(Image) - Array of input images
Returns
Output image
Load svg with rsvg
# out_, flags = Vips::Image.svgload(filename, {dpi: Float64, scale: Float64, unlimited: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
dpi : Float64 - Render at this DPI
scale : Float64 - Scale output by this factor
unlimited : Bool - Allow SVG of any size
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load svg with rsvg
# out_, flags = Vips::Image.svgload_buffer(buffer, {dpi: Float64, scale: Float64, unlimited: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
buffer : Bytes - Buffer to load from
Optionals
dpi : Float64 - Render at this DPI
scale : Float64 - Scale output by this factor
unlimited : Bool - Allow SVG of any size
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load svg from source
# out_, flags = Vips::Image.svgload_source(source, {dpi: Float64, scale: Float64, unlimited: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
dpi : Float64 - Render at this DPI
scale : Float64 - Scale output by this factor
unlimited : Bool - Allow SVG of any size
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load svg from stream
# out_, flags = Vips::Image.svgload_stream(stream, {dpi: Float64, scale: Float64, unlimited: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
dpi : Float64 - Render at this DPI
scale : Float64 - Scale output by this factor
unlimited : Bool - Allow SVG of any size
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Find the index of the first non-zero pixel in tests
# out_ = Vips::Image.switch(tests)
Input Parameters
Required
tests : Array(Image) - Table of images to test
Returns
Output image
Run an external command
, out_, log = Vips::Image.system(cmd_format, {in_: Array(Image), out_format: String, in_format: String})
Input Parameters
Required
cmd_format : String - Command to run
Optionals
in : Array(Image) - Array of input images
out_format : String - Format for output filename
in_format : String - Format for input filename
Returns
Optionals
out : Image? - Output image
log : String? - Command log
Make a text image
# out_, autofit_dpi = Vips::Image.text(text, {font: String, width: Int32, height: Int32, align: Enums::Align, rgba: Bool, dpi: Int32, justify: Bool, spacing: Int32, fontfile: String})
Input Parameters
Required
text : String - Text to render
Optionals
font : String - Font to render with
width : Int32 - Maximum image width in pixels
height : Int32 - Maximum image height in pixels
align : Enums::Align - Align on the low, centre or high edge
rgba : Bool - Enable RGBA output
dpi : Int32 - DPI to render at
justify : Bool - Justify lines
spacing : Int32 - Line spacing
fontfile : String - Load this font file
Returns
Output image
Optionals
autofit_dpi : Int32? - DPI selected by autofit
Generate thumbnail from file
# out_ = Vips::Image.thumbnail(filename, width, {height: Int32, size: Enums::Size, no_rotate: Bool, crop: Enums::Interesting, linear: Bool, import_profile: String, export_profile: String, intent: Enums::Intent})
Input Parameters
Required
filename : String - Filename to read from
width : Int32 - Size to this width
Optionals
height : Int32 - Size to this height
size : Enums::Size - Only upsize, only downsize, or both
no_rotate : Bool - Don't use orientation tags to rotate image upright
crop : Enums::Interesting - Reduce to fill target rectangle, then crop
linear : Bool - Reduce in linear light
import_profile : String - Fallback import profile
export_profile : String - Fallback export profile
intent : Enums::Intent - Rendering intent
Returns
Output image
Generate thumbnail from buffer
# out_ = Vips::Image.thumbnail_buffer(buffer, width, {option_string: String, height: Int32, size: Enums::Size, no_rotate: Bool, crop: Enums::Interesting, linear: Bool, import_profile: String, export_profile: String, intent: Enums::Intent})
Input Parameters
Required
buffer : Bytes - Buffer to load from
width : Int32 - Size to this width
Optionals
option_string : String - Options that are passed on to the underlying loader
height : Int32 - Size to this height
size : Enums::Size - Only upsize, only downsize, or both
no_rotate : Bool - Don't use orientation tags to rotate image upright
crop : Enums::Interesting - Reduce to fill target rectangle, then crop
linear : Bool - Reduce in linear light
import_profile : String - Fallback import profile
export_profile : String - Fallback export profile
intent : Enums::Intent - Rendering intent
Returns
Output image
Generate thumbnail from source
# out_ = Vips::Image.thumbnail_source(source, width, {option_string: String, height: Int32, size: Enums::Size, no_rotate: Bool, crop: Enums::Interesting, linear: Bool, import_profile: String, export_profile: String, intent: Enums::Intent})
Input Parameters
Required
source : Source - Source to load from
width : Int32 - Size to this width
Optionals
option_string : String - Options that are passed on to the underlying loader
height : Int32 - Size to this height
size : Enums::Size - Only upsize, only downsize, or both
no_rotate : Bool - Don't use orientation tags to rotate image upright
crop : Enums::Interesting - Reduce to fill target rectangle, then crop
linear : Bool - Reduce in linear light
import_profile : String - Fallback import profile
export_profile : String - Fallback export profile
intent : Enums::Intent - Rendering intent
Returns
Output image
Generate thumbnail from stream
# out_ = Vips::Image.thumbnail_stream(stream, width, {option_string: String, height: Int32, size: Enums::Size, no_rotate: Bool, crop: Enums::Interesting, linear: Bool, import_profile: String, export_profile: String, intent: Enums::Intent})
Input Parameters
Required
stream : IO - Stream to load from
width : Int32 - Size to this width Optionals
option_string : String - Options that are passed on to the underlying loader
height : Int32 - Size to this height
size : Enums::Size - Only upsize, only downsize, or both
no_rotate : Bool - Don't use orientation tags to rotate image upright
crop : Enums::Interesting - Reduce to fill target rectangle, then crop
linear : Bool - Reduce in linear light
import_profile : String - Fallback import profile
export_profile : String - Fallback export profile
intent : Enums::Intent - Rendering intent
Returns
out : Image - Output image Optionals
Load tiff from file
# out_, flags = Vips::Image.tiffload(filename, {page: Int32, subifd: Int32, n: Int32, autorotate: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
page : Int32 - Load this page from the image
subifd : Int32 - Select subifd index
n : Int32 - Load this many pages
autorotate : Bool - Rotate image using orientation tag
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load tiff from buffer
# out_, flags = Vips::Image.tiffload_buffer(buffer, {page: Int32, subifd: Int32, n: Int32, autorotate: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
buffer : Bytes - Buffer to load from
Optionals
page : Int32 - Load this page from the image
subifd : Int32 - Select subifd index
n : Int32 - Load this many pages
autorotate : Bool - Rotate image using orientation tag
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load tiff from source
# out_, flags = Vips::Image.tiffload_source(source, {page: Int32, subifd: Int32, n: Int32, autorotate: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
page : Int32 - Load this page from the image
subifd : Int32 - Select subifd index
n : Int32 - Load this many pages
autorotate : Bool - Rotate image using orientation tag
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load tiff from stream
# out_, flags = Vips::Image.tiffload_stream(stream, {page: Int32, subifd: Int32, n: Int32, autorotate: Bool, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
page : Int32 - Load this page from the image
subifd : Int32 - Select subifd index
n : Int32 - Load this many pages
autorotate : Bool - Rotate image using orientation tag
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Build a look-up table
# out_ = Vips::Image.tonelut({in_max: Int32, out_max: Int32, lb: Float64, lw: Float64, ps: Float64, pm: Float64, ph: Float64, s: Float64, m: Float64, h: Float64})
Input Parameters
Optionals
in_max : Int32 - Size of LUT to build
out_max : Int32 - Maximum value in output LUT
lb : Float64 - Lowest value in output
lw : Float64 - Highest value in output
ps : Float64 - Position of shadow
pm : Float64 - Position of mid-tones
ph : Float64 - Position of highlights
s : Float64 - Adjust shadows by this much
m : Float64 - Adjust mid-tones by this much
h : Float64 - Adjust highlights by this much
Returns
Output image
Load vips from file
# out_, flags = Vips::Image.vipsload(filename, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load vips from source
# out_, flags = Vips::Image.vipsload_source(source, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load vips from stream
# out_, flags = Vips::Image.vipsload_stream(stream, {memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load webp from file
# out_, flags = Vips::Image.webpload(filename, {page: Int32, n: Int32, scale: Float64, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
filename : String - Filename to load from
Optionals
page : Int32 - Load this page from the file
n : Int32 - Load this many pages
scale : Float64 - Scale factor on load
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load webp from buffer
# out_, flags = Vips::Image.webpload_buffer(buffer, {page: Int32, n: Int32, scale: Float64, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
buffer : Bytes - Buffer to load from
Optionals
page : Int32 - Load this page from the file
n : Int32 - Load this many pages
scale : Float64 - Scale factor on load
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load webp from source
# out_, flags = Vips::Image.webpload_source(source, {page: Int32, n: Int32, scale: Float64, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
source : Source - Source to load from
Optionals
page : Int32 - Load this page from the file
n : Int32 - Load this many pages
scale : Float64 - Scale factor on load
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
Output image
Optionals
flags : Enums::ForeignFlags? - Flags for this file
Load webp from stream
# out_, flags = Vips::Image.webpload_stream(stream, {page: Int32, n: Int32, scale: Float64, memory: Bool, access: Enums::Access, fail_on: Enums::FailOn})
Input Parameters
Required
stream : IO - Stream to load from Optionals
page : Int32 - Load this page from the file
n : Int32 - Load this many pages
scale : Float64 - Scale factor on load
memory : Bool - Force open via memory
access : Enums::Access - Required access pattern for this file
fail_on : Enums::FailOn - Error level to fail on
Returns
out : Image - Output image Optionals
flags : Enums::ForeignFlags? - Flags for this file
Make a worley noise image
# out_ = Vips::Image.worley(width, height, {cell_size: Int32, seed: Int32})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
Optionals
cell_size : Int32 - Size of Worley cells
seed : Int32 - Random number seed
Returns
Output image
Make an image where pixel values are coordinates
# out_ = Vips::Image.xyz(width, height, {csize: Int32, dsize: Int32, esize: Int32})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
Optionals
csize : Int32 - Size of third dimension
dsize : Int32 - Size of fourth dimension
esize : Int32 - Size of fifth dimension
Returns
Output image
Make a zone plate
# out_ = Vips::Image.zone(width, height, {uchar: Bool})
Input Parameters
Required
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
Optionals
uchar : Bool - Output an unsigned char image
Returns
Output image
Instance Method Detail
Returns true
if this object is not equal to other.
By default this method is implemented as !(self == other)
so there's no need to override this unless there's a more efficient
way to do it.
Returns false
(other can only be a Value
here).
Add two images
# out_ = left.add(right)
Input Parameters
Required
right : Image - Right-hand image argument
Returns
Output image
Affine transform of an image
# out_ = in.affine(matrix, {interpolate: Interpolate, oarea: Array(Int32), odx: Float64, ody: Float64, idx: Float64, idy: Float64, background: Array(Float64), premultiplied: Bool, extend: Enums::Extend})
Input Parameters
Required
matrix : Array(Float64) - Transformation matrix
Optionals
interpolate : Interpolate - Interpolate pixels with this
oarea : Array(Int32) - Area of output to generate
odx : Float64 - Horizontal output displacement
ody : Float64 - Vertical output displacement
idx : Float64 - Horizontal input displacement
idy : Float64 - Vertical input displacement
background : Array(Float64) - Background value
premultiplied : Bool - Images have premultiplied alpha
extend : Enums::Extend - How to generate the extra pixels
Returns
Output image
Autorotate image by exif tag
# out_, angle, flip = in.autorot()
Returns
Output image
Optionals
angle : Enums::Angle? - Angle image was rotated by
flip : Bool? - Whether the image was flipped or not
Save image in avif format
in.avifsave_stream(stream, {q: Int32, lossless: Bool, compression: Enums::ForeignHeifCompression, effort: Int32, subsample_mode: Enums::ForeignSubsample, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
stream : IO - Stream to save to Optionals
q : Int32 - Q factor
lossless : Bool - Enable lossless compression
compression : Enums::ForeignHeifCompression - Compression format
effort : Int32 - CPU effort
subsample_mode : Enums::ForeignSubsample - Select chroma subsample operation mode
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image in avif format
in.avifsave_target(target, {q: Int32, lossless: Bool, compression: Enums::ForeignHeifCompression, effort: Int32, subsample_mode: Enums::ForeignSubsample, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
target : Target - Target to save to
Optionals
q : Int32 - Q factor
lossless : Bool - Enable lossless compression
compression : Enums::ForeignHeifCompression - Compression format
effort : Int32 - CPU effort
subsample_mode : Enums::ForeignSubsample - Select chroma subsample operation mode
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Boolean operation across image bands
# out_ = in.bandbool(boolean)
Input Parameters
Required
boolean : Enums::OperationBoolean - boolean to perform
Returns
Output image
Fold up x axis into bands
# out_ = in.bandfold({factor: Int32})
Input Parameters
Optionals
factor : Int32 - Fold by this factor
Returns
Output image
Append a set of mixed images and constants bandwise
Append a constant band to an image
# out_ = in.bandjoin_const(c)
Input Parameters
Required
c : Array(Float64) - Array of constants to add
Returns
Output image
Band-wise rank a set of constants.
Optionals
index : Int32 - Select this band element from sorted list
Band-wise rank a set of constants.
Optionals
index : Int32 - Select this band element from sorted list
Band-wise rank a set of images.
Optionals
index : Int32 - Select this band element from sorted list
Band-wise rank a set of mixed images and constants.
Optionals
index : Int32 - Select this band element from sorted list
Unfold image bands into x axis
# out_ = in.bandunfold({factor: Int32})
Input Parameters
Optionals
factor : Int32 - Unfold by this factor
Returns
Output image
Boolean operation on two images
# out_ = left.boolean(right, boolean)
Input Parameters
Required
right : Image - Right-hand image argument
boolean : Enums::OperationBoolean - boolean to perform
Returns
Output image
Boolean operations against a constant
# out_ = in.boolean_const(boolean, c)
Input Parameters
Required
boolean : Enums::OperationBoolean - boolean to perform
c : Array(Float64) - Array of constants
Returns
Output image
Cache an image
# out_ = in.cache({max_tiles: Int32, tile_height: Int32, tile_width: Int32})
Input Parameters
Optionals
max_tiles : Int32 - Maximum number of tiles to cache
tile_height : Int32 - Tile height in pixels
tile_width : Int32 - Tile width in pixels
Returns
Output image
Canny edge detector
# out_ = in.canny({sigma: Float64, precision: Enums::Precision})
Input Parameters
Optionals
sigma : Float64 - Sigma of Gaussian
precision : Enums::Precision - Convolve with this precision
Returns
Output image
Use pixel values to pick cases from an array of constants
Use pixel values to pick cases from an array of constants
Use pixel values to pick cases from an array of images.
Use pixel values to pick cases from an a set of mixed images and constants.
Cast an image
# out_ = in.cast(format, {shift: Bool})
Input Parameters
Required
format : Enums::BandFormat - Format to cast to
Optionals
shift : Bool - Shift integer values up and down
Returns
Output image
Convert to a new colorspace
# out_ = in.colourspace(space, {source_space: Enums::Interpretation})
Input Parameters
Required
space : Enums::Interpretation - Destination color space
Optionals
source_space : Enums::Interpretation - Source color space
Returns
Output image
Convolve with rotating mask
# out_ = in.compass(mask, {times: Int32, angle: Enums::Angle45, combine: Enums::Combine, precision: Enums::Precision, layers: Int32, cluster: Int32})
Input Parameters
Required
mask : Image - Input matrix image
Optionals
times : Int32 - Rotate and convolve this many times
angle : Enums::Angle45 - Rotate mask by this much between convolutions
combine : Enums::Combine - Combine convolution results like this
precision : Enums::Precision - Convolve with this precision
layers : Int32 - Use this many layers in approximation
cluster : Int32 - Cluster lines closer than this in approximation
Returns
Output image
Perform a complex operation on an image
# out_ = in.complex(cmplx)
Input Parameters
Required
cmplx : Enums::OperationComplex - complex to perform
Returns
Output image
Complex binary operations on two images
# out_ = left.complex2(right, cmplx)
Input Parameters
Required
right : Image - Right-hand image argument
cmplx : Enums::OperationComplex2 - binary complex operation to perform
Returns
Output image
Form a complex image from two real images
# out_ = left.complexform(right)
Input Parameters
Required
right : Image - Right-hand image argument
Returns
Output image
Get a component from a complex image
# out_ = in.complexget(get)
Input Parameters
Required
get : Enums::OperationComplexget - complex to perform
Returns
Output image
Blend an array of images with an array of blend modes
# out_ = Vips::Image.composite(images, modes, {x: Array(Int32), y: Array(Int32), compositing_space: Enums::Interpretation, premultiplied: Bool})
Input Parameters
Required
images : Array(Image) - Array of input images
modes : Array(Enums::BlendMode) - Array of Enums::BlendMode
to join with
Optionals
x : Array(Int32) - Array of x coordinates to join at
y : Array(Int32) - Array of y coordinates to join at
compositing_space : Enums::Interpretation
- Composite images in this colour space
premultiplied : Bool - Images have premultiplied alpha
Returns
Output Image
A synonym for #composite2
# out_ = Vips::Image.composite(overlay, mode, {x: Array(Int32), y: Array(Int32), compositing_space: Enums::Interpretation, premultiplied: Bool})
Input Parameters
Required
overlay : Image - Overlay image
*modes : Enums::BlendMode - VipsBlendMode to join with
Optionals
x : Int32 - x position of overlay
y : Int32 - y position of overlay
compositing_space : Enums::Interpretation
- Composite images in this colour space
premultiplied : Bool - Images have premultiplied alpha
Returns
Output image
Blend a pair of images with a blend mode
# out_ = base.composite2(overlay, mode, {x: Int32, y: Int32, compositing_space: Enums::Interpretation, premultiplied: Bool})
Input Parameters
Required
overlay : Image - Overlay image
mode : Enums::BlendMode - VipsBlendMode to join with
Optionals
x : Int32 - x position of overlay
y : Int32 - y position of overlay
compositing_space : Enums::Interpretation - Composite images in this colour space
premultiplied : Bool - Images have premultiplied alpha
Returns
Output image
Convolution operation
# out_ = in.conv(mask, {precision: Enums::Precision, layers: Int32, cluster: Int32})
Input Parameters
Required
mask : Image - Input matrix image
Optionals
precision : Enums::Precision - Convolve with this precision
layers : Int32 - Use this many layers in approximation
cluster : Int32 - Cluster lines closer than this in approximation
Returns
Output image
Approximate integer convolution
# out_ = in.conva(mask, {layers: Int32, cluster: Int32})
Input Parameters
Required
mask : Image - Input matrix image
Optionals
layers : Int32 - Use this many layers in approximation
cluster : Int32 - Cluster lines closer than this in approximation
Returns
Output image
Approximate separable integer convolution
# out_ = in.convasep(mask, {layers: Int32})
Input Parameters
Required
mask : Image - Input matrix image
Optionals
layers : Int32 - Use this many layers in approximation
Returns
Output image
Float convolution operation
# out_ = in.convf(mask)
Input Parameters
Required
mask : Image - Input matrix image
Returns
Output image
Int convolution operation
# out_ = in.convi(mask)
Input Parameters
Required
mask : Image - Input matrix image
Returns
Output image
Seperable convolution operation
# out_ = in.convsep(mask, {precision: Enums::Precision, layers: Int32, cluster: Int32})
Input Parameters
Required
mask : Image - Input matrix image
Optionals
precision : Enums::Precision - Convolve with this precision
layers : Int32 - Use this many layers in approximation
cluster : Int32 - Cluster lines closer than this in approximation
Returns
Output image
Copy an image
# out_ = in.copy({width: Int32, height: Int32, bands: Int32, format: Enums::BandFormat, coding: Enums::Coding, interpretation: Enums::Interpretation, xres: Float64, yres: Float64, xoffset: Int32, yoffset: Int32})
Input Parameters
Optionals
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
bands : Int32 - Number of bands in image
format : Enums::BandFormat - Pixel format in image
coding : Enums::Coding - Pixel coding
interpretation : Enums::Interpretation - Pixel interpretation
xres : Float64 - Horizontal resolution in pixels/mm
yres : Float64 - Vertical resolution in pixels/mm
xoffset : Int32 - Horizontal offset of origin
yoffset : Int32 - Vertical offset of origin
Returns
Output image
Copy an image to a memory area.
This can be useful for reusing results, but can obviously use a lot of memory for large images. See {Image#tilecache} for a way of caching parts of an image.
Returns new memory Image
Count lines in an image
# nolines = in.countlines(direction)
Input Parameters
Required
direction : Enums::Direction - Countlines left-right or up-down
Returns
Number of lines
Save image to csv
in.csvsave(filename, {separator: String, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
separator : String - Separator characters
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to csv
in.csvsave_stream(stream, {separator: String, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
stream : IO - Stream to save to Optionals
separator : String - Separator characters
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to csv
in.csvsave_target(target, {separator: String, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
target : Target - Target to save to
Optionals
separator : String - Separator characters
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Calculate de00
# out_ = left.de00(right)
Input Parameters
Required
right : Image - Right-hand input image
Returns
Output image
Calculate de76
# out_ = left.de76(right)
Input Parameters
Required
right : Image - Right-hand input image
Returns
Output image
Calculate decmc
# out_ = left.decmc(right)
Input Parameters
Required
right : Image - Right-hand input image
Returns
Output image
Divide two images
# out_ = left.divide(right)
Input Parameters
Required
right : Image - Right-hand image argument
Returns
Output image
Save image to deepzoom file
in.dzsave(filename, {basename: String, layout: Enums::ForeignDzLayout, suffix: String, overlap: Int32, tile_size: Int32, centre: Bool, depth: Enums::ForeignDzDepth, angle: Enums::Angle, container: Enums::ForeignDzContainer, properties: Bool, compression: Int32, region_shrink: Enums::RegionShrink, skip_blanks: Int32, no_strip: Bool, id: String, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
basename : String - Base name to save to
layout : Enums::ForeignDzLayout - Directory layout
suffix : String - Filename suffix for tiles
overlap : Int32 - Tile overlap in pixels
tile_size : Int32 - Tile size in pixels
centre : Bool - Center image in tile
depth : Enums::ForeignDzDepth - Pyramid depth
angle : Enums::Angle - Rotate image during save
container : Enums::ForeignDzContainer - Pyramid container type
properties : Bool - Write a properties file to the output directory
compression : Int32 - ZIP deflate compression level
region_shrink : Enums::RegionShrink - Method to shrink regions
skip_blanks : Int32 - Skip tiles which are nearly equal to the background
no_strip : Bool - Don't strip tile metadata
id : String - Resource ID
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to dz buffer
# buffer = in.dzsave_buffer({basename: String, layout: Enums::ForeignDzLayout, suffix: String, overlap: Int32, tile_size: Int32, centre: Bool, depth: Enums::ForeignDzDepth, angle: Enums::Angle, container: Enums::ForeignDzContainer, properties: Bool, compression: Int32, region_shrink: Enums::RegionShrink, skip_blanks: Int32, no_strip: Bool, id: String, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Optionals
basename : String - Base name to save to
layout : Enums::ForeignDzLayout - Directory layout
suffix : String - Filename suffix for tiles
overlap : Int32 - Tile overlap in pixels
tile_size : Int32 - Tile size in pixels
centre : Bool - Center image in tile
depth : Enums::ForeignDzDepth - Pyramid depth
angle : Enums::Angle - Rotate image during save
container : Enums::ForeignDzContainer - Pyramid container type
properties : Bool - Write a properties file to the output directory
compression : Int32 - ZIP deflate compression level
region_shrink : Enums::RegionShrink - Method to shrink regions
skip_blanks : Int32 - Skip tiles which are nearly equal to the background
no_strip : Bool - Don't strip tile metadata
id : String - Resource ID
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Returns
Buffer to save to
Embed an image in a larger image
# out_ = in.embed(x, y, width, height, {extend: Enums::Extend, background: Array(Float64)})
Input Parameters
Required
x : Int32 - Left edge of input in output
y : Int32 - Top edge of input in output
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
Optionals
extend : Enums::Extend - How to generate the extra pixels
background : Array(Float64) - Color for background pixels
Returns
Output image
Extract an area from an image
# out_ = input.extract_area(left, top, width, height)
Input Parameters
Required
left : Int32 - Left edge of extract area
top : Int32 - Top edge of extract area
width : Int32 - Width of extract area
height : Int32 - Height of extract area
Returns
Output image
Extract band from an image
# out_ = in.extract_band(band, {n: Int32})
Input Parameters
Required
band : Int32 - Band to extract
Optionals
n : Int32 - Number of bands to extract
Returns
Output image
Fast correlation
# out_ = in.fastcor(ref)
Input Parameters
Required
ref : Image - Input reference image
Returns
Output image
Fill image zeros with nearest non-zero pixel
# out_, distance = in.fill_nearest()
Returns
Value of nearest non-zero pixel
Optionals
distance : Image? - Distance to nearest non-zero pixel
Search an image for non-edge areas
# output = in.find_trim({threshold: Float64, background: Array(Float64)})
Input Parameters
Optionals
threshold : Float64 - Object threshold
background : Array(Float64) - Color for background pixels
Returns
Left edge of image
Top edge of extract area
Width of extract area
Height of extract area
Save image to fits file
in.fitssave(filename, {strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Flatten alpha out of an image
# out_ = in.flatten({background: Array(Float64), max_alpha: Float64})
Input Parameters
Optionals
background : Array(Float64) - Background value
max_alpha : Float64 - Maximum value of alpha channel
Returns
Output image
Flip an image
# out_ = in.flip(direction)
Input Parameters
Required
direction : Enums::Direction - Direction to flip image
Returns
Output image
Frequency-domain filtering
# out_ = in.freqmult(mask)
Input Parameters
Required
mask : Image - Input mask image
Returns
Output image
Gamma an image
# out_ = in.gamma({exponent: Float64})
Input Parameters
Optionals
exponent : Float64 - Gamma factor
Returns
Output image
Gaussian blur
# out_ = in.gaussblur(sigma, {min_ampl: Float64, precision: Enums::Precision})
Input Parameters
Required
sigma : Float64 - Sigma of Gaussian
Optionals
min_ampl : Float64 - Minimum amplitude of Gaussian
precision : Enums::Precision - Convolve with this precision
Returns
Output image
Get a metadata item from an image. Crystal types are constructed
automatically from the GValue
, if possible.
For example, you can read the ICC profile from an image like this:
profile = image.get "icc-profile-data"
and profile will be an array containing the profile.
Get the GType of a GObject property
Read a point from an image
# out_array = in.getpoint(x, y)
Input Parameters
Required
x : Int32 - Point to read
y : Int32 - Point to read
Returns
Array of output values
Save as gif
in.gifsave(filename, {dither: Float64, effort: Int32, bitdepth: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
dither : Float64 - Amount of dithering
effort : Int32 - Quantisation effort
bitdepth : Int32 - Number of bits per pixel
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save as gif
# buffer = in.gifsave_buffer({dither: Float64, effort: Int32, bitdepth: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Optionals
dither : Float64 - Amount of dithering
effort : Int32 - Quantisation effort
bitdepth : Int32 - Number of bits per pixel
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Returns
Buffer to save to
Save as gif
in.gifsave_stream(stream, {dither: Float64, effort: Int32, bitdepth: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
stream : IO - Stream to save to Optionals
dither : Float64 - Amount of dithering
effort : Int32 - Quantisation effort
bitdepth : Int32 - Number of bits per pixel
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save as gif
in.gifsave_target(target, {dither: Float64, effort: Int32, bitdepth: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
target : Target - Target to save to
Optionals
dither : Float64 - Amount of dithering
effort : Int32 - Quantisation effort
bitdepth : Int32 - Number of bits per pixel
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Global balance an image mosaic
# out_ = in.globalbalance({gamma: Float64, int_output: Bool})
Input Parameters
Optionals
gamma : Float64 - Image gamma
int_output : Bool - Integer output
Returns
Output image
Place an image within a larger image with a certain gravity
# out_ = in.gravity(direction, width, height, {extend: Enums::Extend, background: Array(Float64)})
Input Parameters
Required
direction : Enums::CompassDirection - direction to place image within width/height
width : Int32 - Image width in pixels
height : Int32 - Image height in pixels
Optionals
extend : Enums::Extend - How to generate the extra pixels
background : Array(Float64) - Color for background pixels
Returns
Output image
Grid an image
# out_ = in.grid(tile_height, across, down)
Input Parameters
Required
tile_height : Int32 - chop into tiles this high
across : Int32 - number of tiles across
down : Int32 - number of tiles down
Returns
Output image
Save image in heif format
in.heifsave(filename, {q: Int32, lossless: Bool, compression: Enums::ForeignHeifCompression, effort: Int32, subsample_mode: Enums::ForeignSubsample, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
q : Int32 - Q factor
lossless : Bool - Enable lossless compression
compression : Enums::ForeignHeifCompression - Compression format
effort : Int32 - CPU effort
subsample_mode : Enums::ForeignSubsample - Select chroma subsample operation mode
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image in heif format
# buffer = in.heifsave_buffer({q: Int32, lossless: Bool, compression: Enums::ForeignHeifCompression, effort: Int32, subsample_mode: Enums::ForeignSubsample, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Optionals
q : Int32 - Q factor
lossless : Bool - Enable lossless compression
compression : Enums::ForeignHeifCompression - Compression format
effort : Int32 - CPU effort
subsample_mode : Enums::ForeignSubsample - Select chroma subsample operation mode
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Returns
Buffer to save to
Save image in heif format
in.heifsave_stream(stream, {q: Int32, lossless: Bool, compression: Enums::ForeignHeifCompression, effort: Int32, subsample_mode: Enums::ForeignSubsample, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
stream : IO - Stream to save to Optionals
q : Int32 - Q factor
lossless : Bool - Enable lossless compression
compression : Enums::ForeignHeifCompression - Compression format
effort : Int32 - CPU effort
subsample_mode : Enums::ForeignSubsample - Select chroma subsample operation mode
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image in heif format
in.heifsave_target(target, {q: Int32, lossless: Bool, compression: Enums::ForeignHeifCompression, effort: Int32, subsample_mode: Enums::ForeignSubsample, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
target : Target - Target to save to
Optionals
q : Int32 - Q factor
lossless : Bool - Enable lossless compression
compression : Enums::ForeignHeifCompression - Compression format
effort : Int32 - CPU effort
subsample_mode : Enums::ForeignSubsample - Select chroma subsample operation mode
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Histogram equalisation
# out_ = in.hist_equal({band: Int32})
Input Parameters
Optionals
band : Int32 - Equalise with this band
Returns
Output image
Find image histogram
# out_ = in.hist_find({band: Int32})
Input Parameters
Optionals
band : Int32 - Find histogram of band
Returns
Output histogram
Find indexed image histogram
# out_ = in.hist_find_indexed(index, {combine: Enums::Combine})
Input Parameters
Required
index : Image - Index image
Optionals
combine : Enums::Combine - Combine bins like this
Returns
Output histogram
Find n-dimensional image histogram
# out_ = in.hist_find_ndim({bins: Int32})
Input Parameters
Optionals
bins : Int32 - Number of bins in each dimension
Returns
Output histogram
Test for monotonicity
# monotonic = in.hist_ismonotonic()
Returns
true if in is monotonic
Local histogram equalisation
# out_ = in.hist_local(width, height, {max_slope: Int32})
Input Parameters
Required
width : Int32 - Window width in pixels
height : Int32 - Window height in pixels
Optionals
max_slope : Int32 - Maximum slope (CLAHE)
Returns
Output image
Match two histograms
# out_ = in.hist_match(ref)
Input Parameters
Required
ref : Image - Reference histogram
Returns
Output image
Find hough circle transform
# out_ = in.hough_circle({scale: Int32, min_radius: Int32, max_radius: Int32})
Input Parameters
Optionals
scale : Int32 - Scale down dimensions by this factor
min_radius : Int32 - Smallest radius to search for
max_radius : Int32 - Largest radius to search for
Returns
Output image
Find hough line transform
# out_ = in.hough_line({width: Int32, height: Int32})
Input Parameters
Optionals
width : Int32 - horizontal size of parameter space
height : Int32 - Vertical size of parameter space
Returns
Output image
Output to device with icc profile
# out_ = in.icc_export({pcs: Enums::PCS, intent: Enums::Intent, black_point_compensation: Bool, output_profile: String, depth: Int32})
Input Parameters
Optionals
pcs : Enums::PCS - Set Profile Connection Space
intent : Enums::Intent - Rendering intent
black_point_compensation : Bool - Enable black point compensation
output_profile : String - Filename to load output profile from
depth : Int32 - Output device space depth in bits
Returns
Output image
Import from device with icc profile
# out_ = in.icc_import({pcs: Enums::PCS, intent: Enums::Intent, black_point_compensation: Bool, embedded: Bool, input_profile: String})
Input Parameters
Optionals
pcs : Enums::PCS - Set Profile Connection Space
intent : Enums::Intent - Rendering intent
black_point_compensation : Bool - Enable black point compensation
embedded : Bool - Use embedded input profile, if available
input_profile : String - Filename to load input profile from
Returns
Output image
Transform between devices with icc profiles
# out_ = in.icc_transform(output_profile, {pcs: Enums::PCS, intent: Enums::Intent, black_point_compensation: Bool, embedded: Bool, input_profile: String, depth: Int32})
Input Parameters
Required
output_profile : String - Filename to load output profile from
Optionals
pcs : Enums::PCS - Set Profile Connection Space
intent : Enums::Intent - Rendering intent
black_point_compensation : Bool - Enable black point compensation
embedded : Bool - Use embedded input profile, if available
input_profile : String - Filename to load input profile from
depth : Int32 - Output device space depth in bits
Returns
Output image
ifthenelse an image
Select pixels from th
if self
is non-zero and from el
if
self
is zero. Use the :blend
option to fade smoothly
between th
and el
.
in1 : Image | Float64 | Array(Float64) true values
in2 : Image | Float64 | Array(Float64) false values
blend : Bool (false) Blend smoothly between in1 and in2
Returns merged Image
Insert image @sub into @main at @x, @y
# out_ = main.insert(sub, x, y, {expand: Bool, background: Array(Float64)})
Input Parameters
Required
sub : Image - Sub-image to insert into main image
x : Int32 - Left edge of sub in main
y : Int32 - Top edge of sub in main
Optionals
expand : Bool - Expand output to hold all of both inputs
background : Array(Float64) - Color for new pixels
Returns
Output image
Build an inverted look-up table
# out_ = in.invertlut({size: Int32})
Input Parameters
Optionals
size : Int32 - LUT size to generate
Returns
Output image
Inverse fft
# out_ = in.invfft({real: Bool})
Input Parameters
Optionals
real : Bool - Output only the real part of the transform
Returns
Output image
Join a pair of images
# out_ = in1.join(in2, direction, {expand: Bool, shim: Int32, background: Array(Float64), align: Enums::Align})
Input Parameters
Required
in2 : Image - Second input image
direction : Enums::Direction - Join left-right or up-down
Optionals
expand : Bool - Expand output to hold all of both inputs
shim : Int32 - Pixels between images
background : Array(Float64) - Colour for new pixels
align : Enums::Align - Align on the low, centre or high coordinate edge
Returns
Output image
Save image in jpeg2000 format
in.jp2ksave(filename, {tile_width: Int32, tile_height: Int32, lossless: Bool, q: Int32, subsample_mode: Enums::ForeignSubsample, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to load from
Optionals
tile_width : Int32 - Tile width in pixels
tile_height : Int32 - Tile height in pixels
lossless : Bool - Enable lossless compression
q : Int32 - Q factor
subsample_mode : Enums::ForeignSubsample - Select chroma subsample operation mode
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image in jpeg2000 format
# buffer = in.jp2ksave_buffer({tile_width: Int32, tile_height: Int32, lossless: Bool, q: Int32, subsample_mode: Enums::ForeignSubsample, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Optionals
tile_width : Int32 - Tile width in pixels
tile_height : Int32 - Tile height in pixels
lossless : Bool - Enable lossless compression
q : Int32 - Q factor
subsample_mode : Enums::ForeignSubsample - Select chroma subsample operation mode
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Returns
Buffer to save to
Save image in jpeg2000 format
in.jp2ksave_stream(stream, {tile_width: Int32, tile_height: Int32, lossless: Bool, q: Int32, subsample_mode: Enums::ForeignSubsample, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
stream : IO - Stream to save to Optionals
tile_width : Int32 - Tile width in pixels
tile_height : Int32 - Tile height in pixels
lossless : Bool - Enable lossless compression
q : Int32 - Q factor
subsample_mode : Enums::ForeignSubsample - Select chroma subsample operation mode
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image in jpeg2000 format
in.jp2ksave_target(target, {tile_width: Int32, tile_height: Int32, lossless: Bool, q: Int32, subsample_mode: Enums::ForeignSubsample, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
target : Target - Target to save to
Optionals
tile_width : Int32 - Tile width in pixels
tile_height : Int32 - Tile height in pixels
lossless : Bool - Enable lossless compression
q : Int32 - Q factor
subsample_mode : Enums::ForeignSubsample - Select chroma subsample operation mode
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to jpeg file
in.jpegsave(filename, {q: Int32, profile: String, optimize_coding: Bool, interlace: Bool, trellis_quant: Bool, overshoot_deringing: Bool, optimize_scans: Bool, quant_table: Int32, subsample_mode: Enums::ForeignSubsample, restart_interval: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
q : Int32 - Q factor
profile : String - ICC profile to embed
optimize_coding : Bool - Compute optimal Huffman coding tables
interlace : Bool - Generate an interlaced (progressive) jpeg
trellis_quant : Bool - Apply trellis quantisation to each 8x8 block
overshoot_deringing : Bool - Apply overshooting to samples with extreme values
optimize_scans : Bool - Split spectrum of DCT coefficients into separate scans
quant_table : Int32 - Use predefined quantization table with given index
subsample_mode : Enums::ForeignSubsample - Select chroma subsample operation mode
restart_interval : Int32 - Add restart markers every specified number of mcu
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to jpeg buffer
# buffer = in.jpegsave_buffer({q: Int32, profile: String, optimize_coding: Bool, interlace: Bool, trellis_quant: Bool, overshoot_deringing: Bool, optimize_scans: Bool, quant_table: Int32, subsample_mode: Enums::ForeignSubsample, restart_interval: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Optionals
q : Int32 - Q factor
profile : String - ICC profile to embed
optimize_coding : Bool - Compute optimal Huffman coding tables
interlace : Bool - Generate an interlaced (progressive) jpeg
trellis_quant : Bool - Apply trellis quantisation to each 8x8 block
overshoot_deringing : Bool - Apply overshooting to samples with extreme values
optimize_scans : Bool - Split spectrum of DCT coefficients into separate scans
quant_table : Int32 - Use predefined quantization table with given index
subsample_mode : Enums::ForeignSubsample - Select chroma subsample operation mode
restart_interval : Int32 - Add restart markers every specified number of mcu
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Returns
Buffer to save to
Save image to jpeg mime
in.jpegsave_mime({q: Int32, profile: String, optimize_coding: Bool, interlace: Bool, trellis_quant: Bool, overshoot_deringing: Bool, optimize_scans: Bool, quant_table: Int32, subsample_mode: Enums::ForeignSubsample, restart_interval: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Optionals
q : Int32 - Q factor
profile : String - ICC profile to embed
optimize_coding : Bool - Compute optimal Huffman coding tables
interlace : Bool - Generate an interlaced (progressive) jpeg
trellis_quant : Bool - Apply trellis quantisation to each 8x8 block
overshoot_deringing : Bool - Apply overshooting to samples with extreme values
optimize_scans : Bool - Split spectrum of DCT coefficients into separate scans
quant_table : Int32 - Use predefined quantization table with given index
subsample_mode : Enums::ForeignSubsample - Select chroma subsample operation mode
restart_interval : Int32 - Add restart markers every specified number of mcu
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to jpeg stream
in.jpegsave_stream(stream, {q: Int32, profile: String, optimize_coding: Bool, interlace: Bool, trellis_quant: Bool, overshoot_deringing: Bool, optimize_scans: Bool, quant_table: Int32, subsample_mode: Enums::ForeignSubsample, restart_interval: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
stream : IO - Stream to save to Optionals
q : Int32 - Q factor
profile : String - ICC profile to embed
optimize_coding : Bool - Compute optimal Huffman coding tables
interlace : Bool - Generate an interlaced (progressive) jpeg
trellis_quant : Bool - Apply trellis quantisation to each 8x8 block
overshoot_deringing : Bool - Apply overshooting to samples with extreme values
optimize_scans : Bool - Split spectrum of DCT coefficients into separate scans
quant_table : Int32 - Use predefined quantization table with given index
subsample_mode : Enums::ForeignSubsample - Select chroma subsample operation mode
restart_interval : Int32 - Add restart markers every specified number of mcu
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to jpeg target
in.jpegsave_target(target, {q: Int32, profile: String, optimize_coding: Bool, interlace: Bool, trellis_quant: Bool, overshoot_deringing: Bool, optimize_scans: Bool, quant_table: Int32, subsample_mode: Enums::ForeignSubsample, restart_interval: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
target : Target - Target to save to
Optionals
q : Int32 - Q factor
profile : String - ICC profile to embed
optimize_coding : Bool - Compute optimal Huffman coding tables
interlace : Bool - Generate an interlaced (progressive) jpeg
trellis_quant : Bool - Apply trellis quantisation to each 8x8 block
overshoot_deringing : Bool - Apply overshooting to samples with extreme values
optimize_scans : Bool - Split spectrum of DCT coefficients into separate scans
quant_table : Int32 - Use predefined quantization table with given index
subsample_mode : Enums::ForeignSubsample - Select chroma subsample operation mode
restart_interval : Int32 - Add restart markers every specified number of mcu
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image in jpeg-xl format
in.jxlsave(filename, {tier: Int32, distance: Float64, effort: Int32, lossless: Bool, q: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to load from
Optionals
tier : Int32 - Decode speed tier
distance : Float64 - Target butteraugli distance
effort : Int32 - Encoding effort
lossless : Bool - Enable lossless compression
q : Int32 - Quality factor
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image in jpeg-xl format
# buffer = in.jxlsave_buffer({tier: Int32, distance: Float64, effort: Int32, lossless: Bool, q: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Optionals
tier : Int32 - Decode speed tier
distance : Float64 - Target butteraugli distance
effort : Int32 - Encoding effort
lossless : Bool - Enable lossless compression
q : Int32 - Quality factor
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Returns
Buffer to save to
Save image in jpeg-xl format
in.jxlsave_stream(stream, {tier: Int32, distance: Float64, effort: Int32, lossless: Bool, q: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
stream : IO - Stream to save to Optionals
tier : Int32 - Decode speed tier
distance : Float64 - Target butteraugli distance
effort : Int32 - Encoding effort
lossless : Bool - Enable lossless compression
q : Int32 - Quality factor
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image in jpeg-xl format
in.jxlsave_target(target, {tier: Int32, distance: Float64, effort: Int32, lossless: Bool, q: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
target : Target - Target to save to
Optionals
tier : Int32 - Decode speed tier
distance : Float64 - Target butteraugli distance
effort : Int32 - Encoding effort
lossless : Bool - Enable lossless compression
q : Int32 - Quality factor
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
If image has been killed see #set_kill
, set an error message,
clear the kill
flag and return true. Otherwise return false
Handy for loops which need to run sets of threads which can fail. At least libvips 8.8 is needed. If this version requirement is not met, it will always return false.
Transform cielab to xyz
# out_ = in.lab2xyz({temp: Array(Float64)})
Input Parameters
Optionals
temp : Array(Float64) - Color temperature
Returns
Output image
Label regions in an image
# mask, segments = in.labelregions()
Returns
Mask of region labels
Optionals
segments : Int32? - Number of discrete contigious regions
Calculate (a * in + b)
# out_ = in.linear(a, b, {uchar: Bool})
Input Parameters
Required
a : Array(Float64) - Multiply by this
b : Array(Float64) - Add this
Optionals
uchar : Bool - Output should be uchar
Returns
Output image
Cache an image as a set of lines
# out_ = in.linecache({tile_height: Int32, access: Enums::Access, threaded: Bool, persistent: Bool})
Input Parameters
Optionals
tile_height : Int32 - Tile height in pixels
access : Enums::Access - Expected access pattern
threaded : Bool - Allow threaded access
persistent : Bool - Keep cache between evaluations
Returns
Output image
Save file with imagemagick
in.magicksave(filename, {format: String, quality: Int32, optimize_gif_frames: Bool, optimize_gif_transparency: Bool, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
format : String - Format to save in
quality : Int32 - Quality to use
optimize_gif_frames : Bool - Apply GIF frames optimization
optimize_gif_transparency : Bool - Apply GIF transparency optimization
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save bmp image with imagemagick
in.magicksave_bmp(filename, {format: String, quality: Int32, optimize_gif_frames: Bool, optimize_gif_transparency: Bool, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
format : String - Format to save in
quality : Int32 - Quality to use
optimize_gif_frames : Bool - Apply GIF frames optimization
optimize_gif_transparency : Bool - Apply GIF transparency optimization
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save bmp image to magick buffer
# buffer = in.magicksave_bmp_buffer({format: String, quality: Int32, optimize_gif_frames: Bool, optimize_gif_transparency: Bool, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Optionals
format : String - Format to save in
quality : Int32 - Quality to use
optimize_gif_frames : Bool - Apply GIF frames optimization
optimize_gif_transparency : Bool - Apply GIF transparency optimization
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Returns
Buffer to save to
Save image to magick buffer
# buffer = in.magicksave_buffer({format: String, quality: Int32, optimize_gif_frames: Bool, optimize_gif_transparency: Bool, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Optionals
format : String - Format to save in
quality : Int32 - Quality to use
optimize_gif_frames : Bool - Apply GIF frames optimization
optimize_gif_transparency : Bool - Apply GIF transparency optimization
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Returns
Buffer to save to
Save gif image with imagemagick
in.magicksave_gif(filename, {format: String, quality: Int32, optimize_gif_frames: Bool, optimize_gif_transparency: Bool, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
format : String - Format to save in
quality : Int32 - Quality to use
optimize_gif_frames : Bool - Apply GIF frames optimization
optimize_gif_transparency : Bool - Apply GIF transparency optimization
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save gif image to magick buffer
# buffer = in.magicksave_gif_buffer({format: String, quality: Int32, optimize_gif_frames: Bool, optimize_gif_transparency: Bool, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Optionals
format : String - Format to save in
quality : Int32 - Quality to use
optimize_gif_frames : Bool - Apply GIF frames optimization
optimize_gif_transparency : Bool - Apply GIF transparency optimization
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Returns
Buffer to save to
Resample with a map image
# out_ = in.mapim(index, {interpolate: Interpolate})
Input Parameters
Required
index : Image - Index pixels with this
Optionals
interpolate : Interpolate - Interpolate pixels with this
Returns
Output image
Map an image though a lut
# out_ = in.maplut(lut, {band: Int32})
Input Parameters
Required
lut : Image - Look-up table image
Optionals
band : Int32 - apply one-band lut to this band of in
Returns
Output image
First-order match of two images
# out_ = ref.match(sec, xr1, yr1, xs1, ys1, xr2, yr2, xs2, ys2, {hwindow: Int32, harea: Int32, search: Bool, interpolate: Interpolate})
Input Parameters
Required
sec : Image - Secondary image
xr1 : Int32 - Position of first reference tie-point
yr1 : Int32 - Position of first reference tie-point
xs1 : Int32 - Position of first secondary tie-point
ys1 : Int32 - Position of first secondary tie-point
xr2 : Int32 - Position of second reference tie-point
yr2 : Int32 - Position of second reference tie-point
xs2 : Int32 - Position of second secondary tie-point
ys2 : Int32 - Position of second secondary tie-point
Optionals
hwindow : Int32 - Half window size
harea : Int32 - Half area size
search : Bool - Search to improve tie-points
interpolate : Interpolate - Interpolate pixels with this
Returns
Output image
Apply a math operation to an image
# out_ = in.math(math)
Input Parameters
Required
math : Enums::OperationMath - math to perform
Returns
Output image
Binary math operations
# out_ = left.math2(right, math2)
Input Parameters
Required
right : Image - Right-hand image argument
math2 : Enums::OperationMath2 - math to perform
Returns
Output image
Binary math operations with a constant
# out_ = in.math2_const(math2, c)
Input Parameters
Required
math2 : Enums::OperationMath2 - math to perform
c : Array(Float64) - Array of constants
Returns
Output image
Print matrix
in.matrixprint({strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Optionals
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to matrix
in.matrixsave(filename, {strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to matrix
in.matrixsave_stream(stream, {strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
stream : IO - Stream to save to Optionals
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to matrix
in.matrixsave_target(target, {strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
target : Target - Target to save to
Optionals
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Find image maximum
# out_, x, y, out_array, x_array, y_array = in.max({size: Int32})
Input Parameters
Optionals
size : Int32 - Number of maximum values to find
Returns
Output value
Optionals
x : Int32? - Horizontal position of maximum
y : Int32? - Vertical position of maximum
out_array : Array(Float64)? - Array of output values
x_array : Array(Int32)? - Array of horizontal positions
y_array : Array(Int32)? - Array of vertical positions
Measure a set of patches on a color chart
# out_ = in.measure(h, v, {left: Int32, top: Int32, width: Int32, height: Int32})
Input Parameters
Required
h : Int32 - Number of patches across chart
v : Int32 - Number of patches down chart
Optionals
left : Int32 - Left edge of extract area
top : Int32 - Top edge of extract area
width : Int32 - Width of extract area
height : Int32 - Height of extract area
Returns
Output array of statistics
Merge two images
# out_ = ref.merge(sec, direction, dx, dy, {mblend: Int32})
Input Parameters
Required
sec : Image - Secondary image
direction : Enums::Direction - Horizontal or vertical merge
dx : Int32 - Horizontal displacement from sec to ref
dy : Int32 - Vertical displacement from sec to ref
Optionals
mblend : Int32 - Maximum blend size
Returns
Output image
Find image minimum
# out_, x, y, out_array, x_array, y_array = in.min({size: Int32})
Input Parameters
Optionals
size : Int32 - Number of minimum values to find
Returns
Output value
Optionals
x : Int32? - Horizontal position of minimum
y : Int32? - Vertical position of minimum
out_array : Array(Float64)? - Array of output values
x_array : Array(Int32)? - Array of horizontal positions
y_array : Array(Int32)? - Array of vertical positions
Morphology operation
# out_ = in.morph(mask, morph)
Input Parameters
Required
mask : Image - Input matrix image
morph : Enums::OperationMorphology - Morphological operation to perform
Returns
Output image
Mosaic two images
# out_, dx0, dy0, scale1, angle1, dy1, dx1 = ref.mosaic(sec, direction, xref, yref, xsec, ysec, {hwindow: Int32, harea: Int32, mblend: Int32, bandno: Int32})
Input Parameters
Required
sec : Image - Secondary image
direction : Enums::Direction - Horizontal or vertical mosaic
xref : Int32 - Position of reference tie-point
yref : Int32 - Position of reference tie-point
xsec : Int32 - Position of secondary tie-point
ysec : Int32 - Position of secondary tie-point
Optionals
hwindow : Int32 - Half window size
harea : Int32 - Half area size
mblend : Int32 - Maximum blend size
bandno : Int32 - Band to search for features on
Returns
Output image
Optionals
dx0 : Int32? - Detected integer offset
dy0 : Int32? - Detected integer offset
scale1 : Float64? - Detected scale
angle1 : Float64? - Detected rotation
dy1 : Float64? - Detected first-order displacement
dx1 : Float64? - Detected first-order displacement
First-order mosaic of two images
# out_ = ref.mosaic1(sec, direction, xr1, yr1, xs1, ys1, xr2, yr2, xs2, ys2, {hwindow: Int32, harea: Int32, search: Bool, interpolate: Interpolate, mblend: Int32, bandno: Int32})
Input Parameters
Required
sec : Image - Secondary image
direction : Enums::Direction - Horizontal or vertical mosaic
xr1 : Int32 - Position of first reference tie-point
yr1 : Int32 - Position of first reference tie-point
xs1 : Int32 - Position of first secondary tie-point
ys1 : Int32 - Position of first secondary tie-point
xr2 : Int32 - Position of second reference tie-point
yr2 : Int32 - Position of second reference tie-point
xs2 : Int32 - Position of second secondary tie-point
ys2 : Int32 - Position of second secondary tie-point
Optionals
hwindow : Int32 - Half window size
harea : Int32 - Half area size
search : Bool - Search to improve tie-points
interpolate : Interpolate - Interpolate pixels with this
mblend : Int32 - Maximum blend size
bandno : Int32 - Band to search for features on
Returns
Output image
Pick most-significant byte from an image
# out_ = in.msb({band: Int32})
Input Parameters
Optionals
band : Int32 - Band to msb
Returns
Output image
Multiply two images
# out_ = left.multiply(right)
Input Parameters
Required
right : Image - Right-hand image argument
Returns
Output image
Mutate an image with a block. Inside the block, you can call methods which modify the image, such as setting or removing metadata, or modifying pixels.
For example:
image = image.mutate do |x|
(0..1).step 0.01 do |i|
x.draw_line([255.0], (x.width * i).to_i, 0, 0, (x.height * (1 - i)).to_i)
end
end
See MutableImage
.
A new image is created with the same width, height, format, interpretation, resolution and offset as self, but with every pixel set to the specified value.
You can pass an array to make a many-band image, or a single value to make a one-band image.
A new image is created with the same width, height, format, interpretation, resolution and offset as self, but with every pixel set to the specified value.
You can pass an array to make a many-band image, or a single value to make a one-band image.
Multi-page images can have a page height. If page-height is not set, it defaults to the image height. Note: At least libvips 8.8 is needed.
Save image in pbm format
in.pbmsave_stream(stream, {format: Enums::ForeignPpmFormat, ascii: Bool, bitdepth: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
stream : IO - Stream to save to Optionals
format : Enums::ForeignPpmFormat - Format to save in
ascii : Bool - save as ascii
bitdepth : Int32 - set to 1 to write as a 1 bit image
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image in pbm format
in.pbmsave_target(target, {format: Enums::ForeignPpmFormat, ascii: Bool, bitdepth: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
target : Target - Target to save to
Optionals
format : Enums::ForeignPpmFormat - Format to save in
ascii : Bool - save as ascii
bitdepth : Int32 - set to 1 to write as a 1 bit image
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Find threshold for percent of pixels
# threshold = in.percent(percent)
Input Parameters
Required
percent : Float64 - Percent of pixels
Returns
Threshold above which lie percent of pixels
Save image in pfm format
in.pfmsave_stream(stream, {format: Enums::ForeignPpmFormat, ascii: Bool, bitdepth: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
stream : IO - Stream to save to Optionals
format : Enums::ForeignPpmFormat - Format to save in
ascii : Bool - save as ascii
bitdepth : Int32 - set to 1 to write as a 1 bit image
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image in pfm format
in.pfmsave_target(target, {format: Enums::ForeignPpmFormat, ascii: Bool, bitdepth: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
target : Target - Target to save to
Optionals
format : Enums::ForeignPpmFormat - Format to save in
ascii : Bool - save as ascii
bitdepth : Int32 - set to 1 to write as a 1 bit image
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image in pgm format
in.pgmsave_stream(stream, {format: Enums::ForeignPpmFormat, ascii: Bool, bitdepth: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
stream : IO - Stream to save to Optionals
format : Enums::ForeignPpmFormat - Format to save in
ascii : Bool - save as ascii
bitdepth : Int32 - set to 1 to write as a 1 bit image
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image in pgm format
in.pgmsave_target(target, {format: Enums::ForeignPpmFormat, ascii: Bool, bitdepth: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
target : Target - Target to save to
Optionals
format : Enums::ForeignPpmFormat - Format to save in
ascii : Bool - save as ascii
bitdepth : Int32 - set to 1 to write as a 1 bit image
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Calculate phase correlation
# out_ = in.phasecor(in2)
Input Parameters
Required
in2 : Image - Second input image
Returns
Output image
Save image to png file
in.pngsave(filename, {compression: Int32, interlace: Bool, profile: String, filter: Enums::ForeignPngFilter, palette: Bool, q: Int32, dither: Float64, bitdepth: Int32, effort: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
compression : Int32 - Compression factor
interlace : Bool - Interlace image
profile : String - ICC profile to embed
filter : Enums::ForeignPngFilter - libpng row filter flag(s)
palette : Bool - Quantise to 8bpp palette
q : Int32 - Quantisation quality
dither : Float64 - Amount of dithering
bitdepth : Int32 - Write as a 1, 2, 4, 8 or 16 bit image
effort : Int32 - Quantisation CPU effort
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to png buffer
# buffer = in.pngsave_buffer({compression: Int32, interlace: Bool, profile: String, filter: Enums::ForeignPngFilter, palette: Bool, q: Int32, dither: Float64, bitdepth: Int32, effort: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Optionals
compression : Int32 - Compression factor
interlace : Bool - Interlace image
profile : String - ICC profile to embed
filter : Enums::ForeignPngFilter - libpng row filter flag(s)
palette : Bool - Quantise to 8bpp palette
q : Int32 - Quantisation quality
dither : Float64 - Amount of dithering
bitdepth : Int32 - Write as a 1, 2, 4, 8 or 16 bit image
effort : Int32 - Quantisation CPU effort
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Returns
Buffer to save to
Save image to stream as png
in.pngsave_stream(stream, {compression: Int32, interlace: Bool, profile: String, filter: Enums::ForeignPngFilter, palette: Bool, q: Int32, dither: Float64, bitdepth: Int32, effort: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
stream : IO - Stream to save to Optionals
compression : Int32 - Compression factor
interlace : Bool - Interlace image
profile : String - ICC profile to embed
filter : Enums::ForeignPngFilter - libpng row filter flag(s)
palette : Bool - Quantise to 8bpp palette
q : Int32 - Quantisation quality
dither : Float64 - Amount of dithering
bitdepth : Int32 - Write as a 1, 2, 4, 8 or 16 bit image
effort : Int32 - Quantisation CPU effort
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to target as png
in.pngsave_target(target, {compression: Int32, interlace: Bool, profile: String, filter: Enums::ForeignPngFilter, palette: Bool, q: Int32, dither: Float64, bitdepth: Int32, effort: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
target : Target - Target to save to
Optionals
compression : Int32 - Compression factor
interlace : Bool - Interlace image
profile : String - ICC profile to embed
filter : Enums::ForeignPngFilter - libpng row filter flag(s)
palette : Bool - Quantise to 8bpp palette
q : Int32 - Quantisation quality
dither : Float64 - Amount of dithering
bitdepth : Int32 - Write as a 1, 2, 4, 8 or 16 bit image
effort : Int32 - Quantisation CPU effort
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to ppm file
in.ppmsave(filename, {format: Enums::ForeignPpmFormat, ascii: Bool, bitdepth: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
format : Enums::ForeignPpmFormat - Format to save in
ascii : Bool - save as ascii
bitdepth : Int32 - set to 1 to write as a 1 bit image
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save to ppm
in.ppmsave_stream(stream, {format: Enums::ForeignPpmFormat, ascii: Bool, bitdepth: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
stream : IO - Stream to save to Optionals
format : Enums::ForeignPpmFormat - Format to save in
ascii : Bool - save as ascii
bitdepth : Int32 - set to 1 to write as a 1 bit image
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save to ppm
in.ppmsave_target(target, {format: Enums::ForeignPpmFormat, ascii: Bool, bitdepth: Int32, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
target : Target - Target to save to
Optionals
format : Enums::ForeignPpmFormat - Format to save in
ascii : Bool - save as ascii
bitdepth : Int32 - set to 1 to write as a 1 bit image
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Premultiply image alpha
# out_ = in.premultiply({max_alpha: Float64})
Input Parameters
Optionals
max_alpha : Float64 - Maximum value of alpha channel
Returns
Output image
Find image profiles
# output = in.profile()
Returns
First non-zero pixel in column
First non-zero pixel in row
Resample an image with a quadratic transform
# out_ = in.quadratic(coeff, {interpolate: Interpolate})
Input Parameters
Required
coeff : Image - Coefficient matrix
Optionals
interpolate : Interpolate - Interpolate values with this
Returns
Output image
Save image to radiance file
in.radsave(filename, {strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to radiance buffer
# buffer = in.radsave_buffer({strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Optionals
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Returns
Buffer to save to
Save image to radiance stream
in.radsave_stream(stream, {strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
stream : IO - Stream to save to Optionals
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to radiance target
in.radsave_target(target, {strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
target : Target - Target to save to
Optionals
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Rank filter
# out_ = in.rank(width, height, index)
Input Parameters
Required
width : Int32 - Window width in pixels
height : Int32 - Window height in pixels
index : Int32 - Select pixel at index
Returns
Output image
Save image to raw file
in.rawsave(filename, {strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Write raw image to file descriptor
in.rawsave_fd(fd, {strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
fd : Int32 - File descriptor to write to
Optionals
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Linear recombination with matrix
# out_ = in.recomb(m)
Input Parameters
Required
m : Image - matrix of coefficients
Returns
Output image
Reduce an image
# out_ = in.reduce(hshrink, vshrink, {kernel: Enums::Kernel})
Input Parameters
Required
hshrink : Float64 - Horizontal shrink factor
vshrink : Float64 - Vertical shrink factor
Optionals
kernel : Enums::Kernel - Resampling kernel
Returns
Output image
Shrink an image horizontally
# out_ = in.reduceh(hshrink, {kernel: Enums::Kernel})
Input Parameters
Required
hshrink : Float64 - Horizontal shrink factor
Optionals
kernel : Enums::Kernel - Resampling kernel
Returns
Output image
Shrink an image vertically
# out_ = in.reducev(vshrink, {kernel: Enums::Kernel})
Input Parameters
Required
vshrink : Float64 - Vertical shrink factor
Optionals
kernel : Enums::Kernel - Resampling kernel
Returns
Output image
Relational operation on two images
# out_ = left.relational(right, relational)
Input Parameters
Required
right : Image - Right-hand image argument
relational : Enums::OperationRelational - relational to perform
Returns
Output image
Relational operations against a constant
# out_ = in.relational_const(relational, c)
Input Parameters
Required
relational : Enums::OperationRelational - relational to perform
c : Array(Float64) - Array of constants
Returns
Output image
Remainder after integer division of two images
# out_ = left.remainder(right)
Input Parameters
Required
right : Image - Right-hand image argument
Returns
Output image
Remainder after integer division of an image and a constant
# out_ = in.remainder_const(c)
Input Parameters
Required
c : Array(Float64) - Array of constants
Returns
Output image
Replicate an image
# out_ = in.replicate(across, down)
Input Parameters
Required
across : Int32 - Repeat this many times horizontally
down : Int32 - Repeat this many times vertically
Returns
Output image
Resize an image
# out_ = in.resize(scale, {kernel: Enums::Kernel, vscale: Float64})
Input Parameters
Required
scale : Float64 - Scale image by this factor
Optionals
kernel : Enums::Kernel - Resampling kernel
vscale : Float64 - Vertical scale image by this factor
Returns
Output image
Rotate an image
# out_ = in.rot(angle)
Input Parameters
Required
angle : Enums::Angle - Angle to rotate image
Returns
Output image
Rotate an image
# out_ = in.rot45({angle: Enums::Angle45})
Input Parameters
Optionals
angle : Enums::Angle45 - Angle to rotate image
Returns
Output image
Rotate an image by a number of degrees
# out_ = in.rotate(angle, {interpolate: Interpolate, background: Array(Float64), odx: Float64, ody: Float64, idx: Float64, idy: Float64})
Input Parameters
Required
angle : Float64 - Rotate anticlockwise by this many degrees
Optionals
interpolate : Interpolate - Interpolate pixels with this
background : Array(Float64) - Background value
odx : Float64 - Horizontal output displacement
ody : Float64 - Vertical output displacement
idx : Float64 - Horizontal input displacement
idy : Float64 - Vertical input displacement
Returns
Output image
Perform a round function on an image
# out_ = in.round(round)
Input Parameters
Required
round : Enums::OperationRound - rounding operation to perform
Returns
Output image
Scale an image to 0 - 255. This is the libvips #scale
operation, but
renamed to avoid a clash with the #scale
for convolution masks.
Convert scrgb to bw
# out_ = in.scrgb2bw({depth: Int32})
Input Parameters
Optionals
depth : Int32 - Output device space depth in bits
Returns
Output image
Convert an scrgb image to srgb
# out_ = in.scrgb2srgb({depth: Int32})
Input Parameters
Optionals
depth : Int32 - Output device space depth in bits
Returns
Output image
Check sequential access
# out_ = in.sequential({tile_height: Int32})
Input Parameters
Optionals
tile_height : Int32 - Tile height in pixels
Returns
Output image
Set the kill
flag on an image. Handy for stopping sets of threads.
At least libvips 8.8 is needed.
Enable progress reporting on an image.
When progress reporting is enabled, evaluation of the most downstream
image from this image will report progress using the Enums::Signal::PreEval
,
Enums::Signal::Eval
and Enums::Signal::PostEval
signals.
Enable progress reporting on an image and provide a block which will be executed on feedback. You can use this function to update user-interfaces with progress feedback, for example
image = Vips::Image.new_from_file("huge.jpg", access: Enums::Access.Sequential)
image.set_progress { |percent| puts "#{percent} complete" }
image.dzsave("image-pyramid")
Unsharp masking for print
# out_ = in.sharpen({sigma: Float64, x1: Float64, y2: Float64, y3: Float64, m1: Float64, m2: Float64})
Input Parameters
Optionals
sigma : Float64 - Sigma of Gaussian
x1 : Float64 - Flat/jaggy threshold
y2 : Float64 - Maximum brightening
y3 : Float64 - Maximum darkening
m1 : Float64 - Slope for flat areas
m2 : Float64 - Slope for jaggy areas
Returns
Output image
Shrink an image
# out_ = in.shrink(hshrink, vshrink)
Input Parameters
Required
hshrink : Float64 - Horizontal shrink factor
vshrink : Float64 - Vertical shrink factor
Returns
Output image
Shrink an image horizontally
# out_ = in.shrinkh(hshrink)
Input Parameters
Required
hshrink : Int32 - Horizontal shrink factor
Returns
Output image
Shrink an image vertically
# out_ = in.shrinkv(vshrink)
Input Parameters
Required
vshrink : Int32 - Vertical shrink factor
Returns
Output image
Connects a EvalProc
callback to a signal on this image.
The callback will be triggered every time this signal is issued on this image.
Similarity transform of an image
# out_ = in.similarity({scale: Float64, angle: Float64, interpolate: Interpolate, background: Array(Float64), odx: Float64, ody: Float64, idx: Float64, idy: Float64})
Input Parameters
Optionals
scale : Float64 - Scale by this factor
angle : Float64 - Rotate anticlockwise by this many degrees
interpolate : Interpolate - Interpolate pixels with this
background : Array(Float64) - Background value
odx : Float64 - Horizontal output displacement
ody : Float64 - Vertical output displacement
idx : Float64 - Horizontal input displacement
idy : Float64 - Vertical input displacement
Returns
Output image
Extract an area from an image
# out_ = input.smartcrop(width, height, {interesting: Enums::Interesting})
Input Parameters
Required
width : Int32 - Width of extract area
height : Int32 - Height of extract area
Optionals
interesting : Enums::Interesting - How to measure interestingness
Returns
Output image
Spatial correlation
# out_ = in.spcor(ref)
Input Parameters
Required
ref : Image - Input reference image
Returns
Output image
Statistical difference
# out_ = in.stdif(width, height, {s0: Float64, b: Float64, m0: Float64, a: Float64})
Input Parameters
Required
width : Int32 - Window width in pixels
height : Int32 - Window height in pixels
Optionals
s0 : Float64 - New deviation
b : Float64 - Weight of new deviation
m0 : Float64 - New mean
a : Float64 - Weight of new mean
Returns
Output image
Subsample an image
# out_ = input.subsample(xfac, yfac, {point: Bool})
Input Parameters
Required
xfac : Int32 - Horizontal subsample factor
yfac : Int32 - Vertical subsample factor
Optionals
point : Bool - Point sample
Returns
Output image
Subtract two images
# out_ = left.subtract(right)
Input Parameters
Required
right : Image - Right-hand image argument
Returns
Output image
Generate thumbnail from image
# out_ = in.thumbnail_image(width, {height: Int32, size: Enums::Size, no_rotate: Bool, crop: Enums::Interesting, linear: Bool, import_profile: String, export_profile: String, intent: Enums::Intent})
Input Parameters
Required
width : Int32 - Size to this width
Optionals
height : Int32 - Size to this height
size : Enums::Size - Only upsize, only downsize, or both
no_rotate : Bool - Don't use orientation tags to rotate image upright
crop : Enums::Interesting - Reduce to fill target rectangle, then crop
linear : Bool - Reduce in linear light
import_profile : String - Fallback import profile
export_profile : String - Fallback export profile
intent : Enums::Intent - Rendering intent
Returns
Output image
Save image to tiff file
in.tiffsave(filename, {compression: Enums::ForeignTiffCompression, q: Int32, predictor: Enums::ForeignTiffPredictor, profile: String, tile: Bool, tile_width: Int32, tile_height: Int32, pyramid: Bool, miniswhite: Bool, bitdepth: Int32, resunit: Enums::ForeignTiffResunit, xres: Float64, yres: Float64, bigtiff: Bool, properties: Bool, region_shrink: Enums::RegionShrink, level: Int32, lossless: Bool, depth: Enums::ForeignDzDepth, subifd: Bool, premultiply: Bool, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
compression : Enums::ForeignTiffCompression - Compression for this file
q : Int32 - Q factor
predictor : Enums::ForeignTiffPredictor - Compression prediction
profile : String - ICC profile to embed
tile : Bool - Write a tiled tiff
tile_width : Int32 - Tile width in pixels
tile_height : Int32 - Tile height in pixels
pyramid : Bool - Write a pyramidal tiff
miniswhite : Bool - Use 0 for white in 1-bit images
bitdepth : Int32 - Write as a 1, 2, 4 or 8 bit image
resunit : Enums::ForeignTiffResunit - Resolution unit
xres : Float64 - Horizontal resolution in pixels/mm
yres : Float64 - Vertical resolution in pixels/mm
bigtiff : Bool - Write a bigtiff image
properties : Bool - Write a properties document to IMAGEDESCRIPTION
region_shrink : Enums::RegionShrink - Method to shrink regions
level : Int32 - ZSTD compression level
lossless : Bool - Enable WEBP lossless mode
depth : Enums::ForeignDzDepth - Pyramid depth
subifd : Bool - Save pyr layers as sub-IFDs
premultiply : Bool - Save with premultiplied alpha
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to tiff buffer
# buffer = in.tiffsave_buffer({compression: Enums::ForeignTiffCompression, q: Int32, predictor: Enums::ForeignTiffPredictor, profile: String, tile: Bool, tile_width: Int32, tile_height: Int32, pyramid: Bool, miniswhite: Bool, bitdepth: Int32, resunit: Enums::ForeignTiffResunit, xres: Float64, yres: Float64, bigtiff: Bool, properties: Bool, region_shrink: Enums::RegionShrink, level: Int32, lossless: Bool, depth: Enums::ForeignDzDepth, subifd: Bool, premultiply: Bool, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Optionals
compression : Enums::ForeignTiffCompression - Compression for this file
q : Int32 - Q factor
predictor : Enums::ForeignTiffPredictor - Compression prediction
profile : String - ICC profile to embed
tile : Bool - Write a tiled tiff
tile_width : Int32 - Tile width in pixels
tile_height : Int32 - Tile height in pixels
pyramid : Bool - Write a pyramidal tiff
miniswhite : Bool - Use 0 for white in 1-bit images
bitdepth : Int32 - Write as a 1, 2, 4 or 8 bit image
resunit : Enums::ForeignTiffResunit - Resolution unit
xres : Float64 - Horizontal resolution in pixels/mm
yres : Float64 - Vertical resolution in pixels/mm
bigtiff : Bool - Write a bigtiff image
properties : Bool - Write a properties document to IMAGEDESCRIPTION
region_shrink : Enums::RegionShrink - Method to shrink regions
level : Int32 - ZSTD compression level
lossless : Bool - Enable WEBP lossless mode
depth : Enums::ForeignDzDepth - Pyramid depth
subifd : Bool - Save pyr layers as sub-IFDs
premultiply : Bool - Save with premultiplied alpha
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Returns
Buffer to save to
Cache an image as a set of tiles
# out_ = in.tilecache({tile_width: Int32, tile_height: Int32, max_tiles: Int32, access: Enums::Access, threaded: Bool, persistent: Bool})
Input Parameters
Optionals
tile_width : Int32 - Tile width in pixels
tile_height : Int32 - Tile height in pixels
max_tiles : Int32 - Maximum number of tiles to cache
access : Enums::Access - Expected access pattern
threaded : Bool - Allow threaded access
persistent : Bool - Keep cache between evaluations
Returns
Output image
Appends a short String representation of this object which includes its class name and its object address.
class Person
def initialize(@name : String, @age : Int32)
end
end
Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Transpose3d an image
# out_ = in.transpose3d({page_height: Int32})
Input Parameters
Optionals
page_height : Int32 - Height of each input page
Returns
Output image
Unpremultiply image alpha
# out_ = in.unpremultiply({max_alpha: Float64, alpha_band: Int32})
Input Parameters
Optionals
max_alpha : Float64 - Maximum value of alpha channel
alpha_band : Int32 - Unpremultiply with this alpha
Returns
Output image
Save image to file in vips format
in.vipssave(filename, {strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to stream in vips format
in.vipssave_stream(stream, {strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
stream : IO - Stream to save to Optionals
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to target in vips format
in.vipssave_target(target, {strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
target : Target - Target to save to
Optionals
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to webp file
in.webpsave(filename, {q: Int32, lossless: Bool, preset: Enums::ForeignWebpPreset, smart_subsample: Bool, near_lossless: Bool, alpha_q: Int32, min_size: Bool, kmin: Int32, kmax: Int32, effort: Int32, profile: String, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
filename : String - Filename to save to
Optionals
q : Int32 - Q factor
lossless : Bool - enable lossless compression
preset : Enums::ForeignWebpPreset - Preset for lossy compression
smart_subsample : Bool - Enable high quality chroma subsampling
near_lossless : Bool - Enable preprocessing in lossless mode (uses Q)
alpha_q : Int32 - Change alpha plane fidelity for lossy compression
min_size : Bool - Optimise for minium size
kmin : Int32 - Minimum number of frames between key frames
kmax : Int32 - Maximum number of frames between key frames
effort : Int32 - Level of CPU effort to reduce file size
profile : String - ICC profile to embed
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to webp buffer
# buffer = in.webpsave_buffer({q: Int32, lossless: Bool, preset: Enums::ForeignWebpPreset, smart_subsample: Bool, near_lossless: Bool, alpha_q: Int32, min_size: Bool, kmin: Int32, kmax: Int32, effort: Int32, profile: String, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Optionals
q : Int32 - Q factor
lossless : Bool - enable lossless compression
preset : Enums::ForeignWebpPreset - Preset for lossy compression
smart_subsample : Bool - Enable high quality chroma subsampling
near_lossless : Bool - Enable preprocessing in lossless mode (uses Q)
alpha_q : Int32 - Change alpha plane fidelity for lossy compression
min_size : Bool - Optimise for minium size
kmin : Int32 - Minimum number of frames between key frames
kmax : Int32 - Maximum number of frames between key frames
effort : Int32 - Level of CPU effort to reduce file size
profile : String - ICC profile to embed
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Returns
Buffer to save to
Save image to webp stream
in.webpsave_stream(stream, {q: Int32, lossless: Bool, preset: Enums::ForeignWebpPreset, smart_subsample: Bool, near_lossless: Bool, alpha_q: Int32, min_size: Bool, kmin: Int32, kmax: Int32, effort: Int32, profile: String, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
stream : IO - Stream to save to Optionals
q : Int32 - Q factor
lossless : Bool - enable lossless compression
preset : Enums::ForeignWebpPreset - Preset for lossy compression
smart_subsample : Bool - Enable high quality chroma subsampling
near_lossless : Bool - Enable preprocessing in lossless mode (uses Q)
alpha_q : Int32 - Change alpha plane fidelity for lossy compression
min_size : Bool - Optimise for minium size
kmin : Int32 - Minimum number of frames between key frames
kmax : Int32 - Maximum number of frames between key frames
effort : Int32 - Level of CPU effort to reduce file size
profile : String - ICC profile to embed
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Save image to webp target
in.webpsave_target(target, {q: Int32, lossless: Bool, preset: Enums::ForeignWebpPreset, smart_subsample: Bool, near_lossless: Bool, alpha_q: Int32, min_size: Bool, kmin: Int32, kmax: Int32, effort: Int32, profile: String, strip: Bool, background: Array(Float64), page_height: Int32})
Input Parameters
Required
target : Target - Target to save to
Optionals
q : Int32 - Q factor
lossless : Bool - enable lossless compression
preset : Enums::ForeignWebpPreset - Preset for lossy compression
smart_subsample : Bool - Enable high quality chroma subsampling
near_lossless : Bool - Enable preprocessing in lossless mode (uses Q)
alpha_q : Int32 - Change alpha plane fidelity for lossy compression
min_size : Bool - Optimise for minium size
kmin : Int32 - Minimum number of frames between key frames
kmax : Int32 - Maximum number of frames between key frames
effort : Int32 - Level of CPU effort to reduce file size
profile : String - ICC profile to embed
strip : Bool - Strip all metadata from image
background : Array(Float64) - Background value
page_height : Int32 - Set page height for multipage save
Wrap image origin
# out_ = in.wrap({x: Int32, y: Int32})
Input Parameters
Optionals
x : Int32 - Left edge of input in output
y : Int32 - Top edge of input in output
Returns
Output image
Write an image to another image.
This function writes self
to another image. Use something like
.new_temp_file
to make an image that can be written to.
Write this image to a memory buffer. This method can save images in any format supported by vips. Save options may be encoded in the filename or given as a keyword argument. For example:
image.write_to_file("fred.jpg[Q=95])"
or equivalently:
image.write_to_file("fred.jpg", Q: 95)
The full set of save options depend on the selected saver. Try something like:
$ vips jpegsave
to see all the available options for JPEG save.
Get the GType
of a metadata field. The result is 0 if no such field
exists.
Write the image to a Bytes
.
A large area of memory is allocated, the image is rendered to that
memory array, and the array is returned as a buffer.
For example, if you have a 2x2 uchar image containing the bytes 1, 2, 3, 4, read left-to-right, top-to-bottom, then:
buf = image.write_to_memory # => return Bytes of size 4 containing values 1,2,3,4
Returns Bytes
Write this image to a file. This method can save images in any format supported by vips. Save options may be encoded in the filename or given as a keyword argument. For example:
image.write_to_file("fred.jpg[Q=95])"
or equivalently:
image.write_to_file("fred.jpg", Q: 95)
The full set of save options depend on the selected saver. Try something like:
$ vips jpegsave
to see all the available options for JPEG save.
Get the GType
of a metadata field. The result is 0 if no such field
exists.
Write the image to memory as a simple, unformatted C-style array.
Note: The caller is responsible for freeing this memory with Vips.free
Returns {Void*, LibC::SizeT}
Write an image to a stream.
This behaves exactly as #write_to_file
, but the image is
written to a stream rather than a file.
Note: At least libvips 8.9 is needed.
Write an image to a target.
This behaves exactly as #write_to_file
, but the image is
written to a target rather than a file.
Note: At least libvips 8.9 is needed.
Transform xyz to lab
# out_ = in.xyz2lab({temp: Array(Float64)})
Input Parameters
Optionals
temp : Array(Float64) - Colour temperature
Returns
Output image
Zoom an image
# out_ = input.zoom(xfac, yfac)
Input Parameters
Required
xfac : Int32 - Horizontal zoom factor
yfac : Int32 - Vertical zoom factor
Returns
Output image