RubyDoc.info:

Class: Vips::Image

– Documentation for ruby-vips (2.2.3)

– RubyDoc.info (original) (raw)

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, **options) ⇒ Object

Invoke a vips operation with Operation.call, using self as the first input argument.

228 229 230 # File 'lib/vips/image.rb', line 228 def method_missing name, *args, **options Vips::Operation.call name.to_s, [self, *args], options end

Class Method Details

.analyzeload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 999 | | ------------------------------------------ |

.arrayjoin(im, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 375 | | ------------------------------------------ |

.bandrank(im, **opts) ⇒ Vips::Image

Band-wise rank of a set of images.

| | # File 'lib/vips/methods.rb', line 430 | | ------------------------------------------ |

.black(width, height, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 593 | | ------------------------------------------ |

.csvload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 908 | | ------------------------------------------ |

.csvload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 923 | | ------------------------------------------ |

.eye(width, height, **opts) ⇒ Vips::Image

Make an image showing the eye's spatial response.

| | # File 'lib/vips/methods.rb', line 668 | | ------------------------------------------ |

.fitsload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1358 | | ------------------------------------------- |

.fitsload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1369 | | ------------------------------------------- |

.fractsurf(width, height, fractal_dimension, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 875 | | ------------------------------------------ |

.gaussmat(sigma, min_ampl, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 621 | | ------------------------------------------ |

.gaussnoise(width, height, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 601 | | ------------------------------------------ |

.gifload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1143 | | ------------------------------------------- |

.gifload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1156 | | ------------------------------------------- |

.gifload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1169 | | ------------------------------------------- |

.grey(width, height, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 677 | | ------------------------------------------ |

.heifload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1445 | | ------------------------------------------- |

.heifload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1460 | | ------------------------------------------- |

.heifload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1475 | | ------------------------------------------- |

.identity(**opts) ⇒ Vips::Image

Make a 1d image where pixel values are indexes.

| | # File 'lib/vips/methods.rb', line 867 | | ------------------------------------------ |

.jp2kload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1107 | | ------------------------------------------- |

.jp2kload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1119 | | ------------------------------------------- |

.jp2kload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1131 | | ------------------------------------------- |

.jpegload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1229 | | ------------------------------------------- |

.jpegload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1243 | | ------------------------------------------- |

.jpegload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

Load image from jpeg source.

| | # File 'lib/vips/methods.rb', line 1257 | | ------------------------------------------- |

.jxlload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1490 | | ------------------------------------------- |

.jxlload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1503 | | ------------------------------------------- |

.jxlload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1516 | | ------------------------------------------- |

.logmat(sigma, min_ampl, **opts) ⇒ Vips::Image

Make a laplacian of gaussian image.

| | # File 'lib/vips/methods.rb', line 630 | | ------------------------------------------ |

.magickload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

Load file with imagemagick.

| | # File 'lib/vips/methods.rb', line 1580 | | ------------------------------------------- |

.magickload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

Load buffer with imagemagick.

| | # File 'lib/vips/methods.rb', line 1594 | | ------------------------------------------- |

.mask_butterworth(width, height, order, frequency_cutoff, amplitude_cutoff, **opts) ⇒ Vips::Image

Make a butterworth filter.

| | # File 'lib/vips/methods.rb', line 742 | | ------------------------------------------ |

.mask_butterworth_band(width, height, order, frequency_cutoff_x, frequency_cutoff_y, radius, amplitude_cutoff, **opts) ⇒ Vips::Image

Make a butterworth_band filter.

| | # File 'lib/vips/methods.rb', line 771 | | ------------------------------------------ |

.mask_butterworth_ring(width, height, order, frequency_cutoff, amplitude_cutoff, ringwidth, **opts) ⇒ Vips::Image

Make a butterworth ring filter.

| | # File 'lib/vips/methods.rb', line 756 | | ------------------------------------------ |

.mask_fractal(width, height, fractal_dimension, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 829 | | ------------------------------------------ |

.mask_gaussian(width, height, frequency_cutoff, amplitude_cutoff, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 787 | | ------------------------------------------ |

.mask_gaussian_band(width, height, frequency_cutoff_x, frequency_cutoff_y, radius, amplitude_cutoff, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 814 | | ------------------------------------------ |

.mask_gaussian_ring(width, height, frequency_cutoff, amplitude_cutoff, ringwidth, **opts) ⇒ Vips::Image

Make a gaussian ring filter.

| | # File 'lib/vips/methods.rb', line 800 | | ------------------------------------------ |

.mask_ideal(width, height, frequency_cutoff, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 703 | | ------------------------------------------ |

.mask_ideal_band(width, height, frequency_cutoff_x, frequency_cutoff_y, radius, **opts) ⇒ Vips::Image

Make an ideal band filter.

| | # File 'lib/vips/methods.rb', line 728 | | ------------------------------------------ |

.mask_ideal_ring(width, height, frequency_cutoff, ringwidth, **opts) ⇒ Vips::Image

Make an ideal ring filter.

| | # File 'lib/vips/methods.rb', line 715 | | ------------------------------------------ |

.matload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1218 | | ------------------------------------------- |

.matrix_from_array(width, height, array) ⇒ Object

471 472 473 474 475 476 477 # File 'lib/vips/image.rb', line 471 def self.matrix_from_array width, height, array ptr = FFI::MemoryPointer.new :double, array.length ptr.write_array_of_double array image = Vips.vips_image_new_matrix_from_array width, height, ptr, array.length Vips::Image.new image end

.matrixload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 938 | | ------------------------------------------ |

.matrixload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 949 | | ------------------------------------------ |

.method_missing(name, *args, **options) ⇒ Object

233 234 235 # File 'lib/vips/image.rb', line 233 def self.method_missing name, *args, **options Vips::Operation.call name.to_s, args, options end

.new_from_array(array, scale = 1, offset = 0) ⇒ 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.

| 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | # File 'lib/vips/image.rb', line 505 def self.new_from_array array, scale = 1, offset = 0 unless array.is_a? Array raise Vips::Error, "Argument is not an array." end if array[0].is_a? Array height = array.length width = array[0].length unless array.all? { |x| x.is_a? Array } raise Vips::Error, "Not a 2D array." end unless array.all? { | x| x.length == width } raise Vips::Error, "Array not rectangular." end array = array.flatten else height = 1 width = array.length end unless array.length == width * height raise Vips::Error, "Bad array dimensions." end unless array.all? { | x| x.is_a? Numeric } raise Vips::Error, "Not all array elements are Numeric." end image = Vips::Image.matrix_from_array width, height, array raise Vips::Error if image.nil? image.mutate do | mutable| mutable.set_type! GObject::GDOUBLE_TYPE, "scale", scale.to_f mutable.set_type! GObject::GDOUBLE_TYPE, "offset", offset.to_f end end | | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

.new_from_buffer(data, option_string, **opts) ⇒ Image

Create a new Vips::Image for an image encoded in a format such as JPEG in a binary string. Load options may be passed as strings or appended as a hash. 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.

317 318 319 320 321 322 # File 'lib/vips/image.rb', line 317 def self.new_from_buffer data, option_string, **opts loader = Vips.vips_foreign_find_load_buffer data, data.bytesize raise Vips::Error if loader.nil? Vips::Operation.call loader, [data], opts, option_string end

.new_from_file(name, **opts) ⇒ Image

Return a new Vips::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 a hash, 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.

273 274 275 276 277 278 279 280 281 282 283 284 # File 'lib/vips/image.rb', line 273 def self.new_from_file name, **opts raise Vips::Error, "filename is nil" if name.nil? filename = Vips.p2str(Vips.vips_filename_get_filename(name)) option_string = Vips.p2str(Vips.vips_filename_get_options(name)) loader = Vips.vips_foreign_find_load filename raise Vips::Error if loader.nil? Operation.call loader, [filename], opts, option_string end

.new_from_memory(data, width, height, bands, format) ⇒ Image

Create a new Vips::Image from a C-style array held in memory. For example:

image = Vips::Image.black(16, 16) + 128
data = image.write_to_memory

x = Vips::Image.new_from_memory data,
  image.width, image.height, image.bands, image.format

Creating a new image from a memory pointer:

ptr = FFI::MemoryPointer.new(:uchar, 10*10)
# => #<FFI::MemoryPointer address=0x00007fc236db31d0 size=100>
x = Vips::Image.new_from_memory(ptr, 10, 10, 1, :uchar)

Creating a new image from an address only pointer:

ptr = call_to_external_c_library(w: 10, h: 10)
# => #<FFI::Pointer address=0x00007f9780813a00>
ptr_slice = ptr.slice(0, 10*10)
# => #<FFI::Pointer address=0x00007f9780813a00 size=100>
x = Vips::Image.new_from_memory(ptr_slice, 10, 10, 1, :uchar)

new_from_memory keeps a reference to the array of pixels you pass in to try to prevent that memory from being freed by the Ruby GC while it is being used.

See new_from_memory_copy for a version of this method which does not keep a reference.

365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 # File 'lib/vips/image.rb', line 365 def self.new_from_memory data, width, height, bands, format if defined?(JRUBY_VERSION) && !data.is_a?(FFI::Pointer) data = ::FFI::MemoryPointer.new(:char, data.bytesize).write_bytes data end if data.is_a?(FFI::Pointer) if data.size == UNKNOWN_POINTER_SIZE raise Vips::Error, "size of memory is unknown" end size = data.size else size = data.bytesize end format_number = GObject::GValue.from_nick BAND_FORMAT_TYPE, format vi = Vips.vips_image_new_from_memory data, size, width, height, bands, format_number raise Vips::Error if vi.null? image = new(vi) image.references << data image end

.new_from_memory_copy(data, width, height, bands, format) ⇒ Image

Create a new Vips::Image from memory and copies the memory area. Seenew_from_memory for a version of this method which does not copy the memory area.

407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 # File 'lib/vips/image.rb', line 407 def self.new_from_memory_copy data, width, height, bands, format format_number = GObject::GValue.from_nick BAND_FORMAT_TYPE, format if data.is_a?(FFI::Pointer) if data.size == UNKNOWN_POINTER_SIZE raise Vips::Error, "size of memory is unknown" end size = data.size else size = data.bytesize end vi = Vips.vips_image_new_from_memory_copy data, size, width, height, bands, format_number raise Vips::Error if vi.null? new(vi) end

.new_from_source(source, option_string, **opts) ⇒ Image

Create a new Vips::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.

457 458 459 460 461 462 463 464 465 466 467 468 469 # File 'lib/vips/image.rb', line 457 def self.new_from_source source, option_string, **opts loader = Vips.vips_foreign_find_load_source source raise Vips::Error if loader.nil? result = Vips::Operation.call loader, [source], opts, option_string result.references << source result end

.niftiload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1391 | | ------------------------------------------- |

.niftiload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1402 | | ------------------------------------------- |

.openexrload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1380 | | ------------------------------------------- |

.openslideload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

Load file with openslide.

| | # File 'lib/vips/methods.rb', line 1413 | | ------------------------------------------- |

.openslideload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

Load source with openslide.

| | # File 'lib/vips/methods.rb', line 1429 | | ------------------------------------------- |

.pdfload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1529 | | ------------------------------------------- |

.pdfload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1546 | | ------------------------------------------- |

.pdfload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1563 | | ------------------------------------------- |

.perlin(width, height, **opts) ⇒ Vips::Image

Make a perlin noise image.

| | # File 'lib/vips/methods.rb', line 892 | | ------------------------------------------ |

.pngload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1182 | | ------------------------------------------- |

.pngload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1194 | | ------------------------------------------- |

.pngload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1206 | | ------------------------------------------- |

.ppmload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1010 | | ------------------------------------------- |

.ppmload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1021 | | ------------------------------------------- |

.profile_load(name, **opts) ⇒ VipsBlob

| | # File 'lib/vips/methods.rb', line 2750 | | ------------------------------------------- |

.radload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

Load a radiance image from a file.

| | # File 'lib/vips/methods.rb', line 1032 | | ------------------------------------------- |

.radload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1043 | | ------------------------------------------- |

.radload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1054 | | ------------------------------------------- |

.rawload(filename, width, height, bands, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

Load raw data from a file.

| | # File 'lib/vips/methods.rb', line 960 | | ------------------------------------------ |

.respond_to_missing?(name, include_all = false) ⇒ Boolean

216 217 218 219 220 221 # File 'lib/vips/image.rb', line 216 def self.respond_to_missing? name, include_all = false return true if Vips.type_find("VipsOperation", name.to_s) != 0 super end

.sdf(width, height, shape, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 656 | | ------------------------------------------ |

.sines(width, height, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 693 | | ------------------------------------------ |

.sum(im, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 172 | | ------------------------------------------ |

.svgload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1065 | | ------------------------------------------- |

.svgload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1079 | | ------------------------------------------- |

.svgload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1093 | | ------------------------------------------- |

.switch(tests, **opts) ⇒ Vips::Image

Find the index of the first non-zero pixel in tests.

| | # File 'lib/vips/methods.rb', line 902 | | ------------------------------------------ |

.system(cmd_format, **opts) ⇒ nil, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 4 | | ---------------------------------------- |

.text(text, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 639 | | ------------------------------------------ |

.thumbnail(filename, width, **opts) ⇒ Vips::Image

Generate thumbnail from file.

| | # File 'lib/vips/methods.rb', line 2381 | | ------------------------------------------- |

.thumbnail_buffer(buffer, width, **opts) ⇒ Vips::Image

Generate thumbnail from buffer.

| | # File 'lib/vips/methods.rb', line 2397 | | ------------------------------------------- |

.thumbnail_source(source, width, **opts) ⇒ Vips::Image

Generate thumbnail from source.

| | # File 'lib/vips/methods.rb', line 2429 | | ------------------------------------------- |

.tiffload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1313 | | ------------------------------------------- |

.tiffload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1328 | | ------------------------------------------- |

.tiffload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1343 | | ------------------------------------------- |

.tonelut(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 852 | | ------------------------------------------ |

.vipsload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 977 | | ------------------------------------------ |

.vipsload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 988 | | ------------------------------------------ |

.webpload(filename, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1271 | | ------------------------------------------- |

.webpload_buffer(buffer, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1285 | | ------------------------------------------- |

.webpload_source(source, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 1299 | | ------------------------------------------- |

.worley(width, height, **opts) ⇒ Vips::Image

Make a worley noise image.

| | # File 'lib/vips/methods.rb', line 883 | | ------------------------------------------ |

.xyz(width, height, **opts) ⇒ Vips::Image

Make an image where pixel values are coordinates.

| | # File 'lib/vips/methods.rb', line 611 | | ------------------------------------------ |

.zone(width, height, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 685 | | ------------------------------------------ |

Instance Method Details

#!Image

1100 1101 1102 # File 'lib/vips/image.rb', line 1100 def ! self ^ -1 end

#!=(other) ⇒ Image

Compare inequality to nil, an image, constant or array.

1174 1175 1176 1177 1178 1179 1180 1181 # File 'lib/vips/image.rb', line 1174 def != other if other.nil? true else call_enum "relational", other, :noteq end end

#%(other) ⇒ Image

Remainder after integer division with an image, constant or array.

1044 1045 1046 1047 # File 'lib/vips/image.rb', line 1044 def % other other.is_a?(Vips::Image) ? remainder(other) : remainder_const(other) end

#&(other) ⇒ Image

Integer bitwise AND with an image, constant or array.

1085 1086 1087 # File 'lib/vips/image.rb', line 1085 def & other call_enum "boolean", other, :and end

#*(other) ⇒ Image

Multiply an image, constant or array.

1026 1027 1028 1029 # File 'lib/vips/image.rb', line 1026 def * other other.is_a?(Vips::Image) ? multiply(other) : linear(other, 0) end

#**(other) ⇒ Image

Raise to power of an image, constant or array.

1053 1054 1055 # File 'lib/vips/image.rb', line 1053 def ** other call_enum "math2", other, :pow end

#+(other) ⇒ Image

Add an image, constant or array.

1008 1009 1010 1011 # File 'lib/vips/image.rb', line 1008 def + other other.is_a?(Vips::Image) ? add(other) : linear(1, other) end

#+@Image

1112 1113 1114 # File 'lib/vips/image.rb', line 1112 def +@ self end

#-(other) ⇒ Image

Subtract an image, constant or array.

| 1017 1018 1019 1020 | # File 'lib/vips/image.rb', line 1017 def - other other.is_a?(Vips::Image) ? subtract(other) : linear(1, Image.smap(other) { |x| x * -1 }) end | | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

#-@Image

1119 1120 1121 # File 'lib/vips/image.rb', line 1119 def -@ self * -1 end

#/(other) ⇒ Image

Divide an image, constant or array.

| 1035 1036 1037 1038 | # File 'lib/vips/image.rb', line 1035 def / other other.is_a?(Vips::Image) ? divide(other) : linear(Image.smap(other) { |x| 1.0 / x }, 0) end | | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

#<(other) ⇒ Image

Relational less than with an image, constant or array.

1127 1128 1129 # File 'lib/vips/image.rb', line 1127 def < other call_enum "relational", other, :less end

#<<(other) ⇒ Image

Integer left shift with an image, constant or array.

1061 1062 1063 # File 'lib/vips/image.rb', line 1061 def << other call_enum "boolean", other, :lshift end

#<=(other) ⇒ Image

Relational less than or equal to with an image, constant or array.

1136 1137 1138 # File 'lib/vips/image.rb', line 1136 def <= other call_enum "relational", other, :lesseq end

#==(other) ⇒ Image

Compare equality to nil, an image, constant or array.

1161 1162 1163 1164 1165 1166 1167 1168 # File 'lib/vips/image.rb', line 1161 def == other if other.nil? false else call_enum "relational", other, :equal end end

#>(other) ⇒ Image

Relational more than with an image, constant or array.

1144 1145 1146 # File 'lib/vips/image.rb', line 1144 def > other call_enum "relational", other, :more end

#>=(other) ⇒ Image

Relational more than or equal to with an image, constant or array.

1153 1154 1155 # File 'lib/vips/image.rb', line 1153 def >= other call_enum "relational", other, :moreeq end

#>>(other) ⇒ Image

Integer right shift with an image, constant or array.

1069 1070 1071 # File 'lib/vips/image.rb', line 1069 def >> other call_enum "boolean", other, :rshift end

#[](index) ⇒ Image

Fetch bands using a number or a range

1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 # File 'lib/vips/image.rb', line 1187 def [] index if index.is_a? Range n = index.size extract_band index.begin, n: n elsif index.is_a? Numeric extract_band index else raise Vips::Error, "[] index is not range or numeric." end end

#^(other) ⇒ Image

Integer bitwise EOR with an image, constant or array.

1093 1094 1095 # File 'lib/vips/image.rb', line 1093 def ^ other call_enum "boolean", other, :eor end

#abs(**opts) ⇒ Vips::Image

Absolute value of an image.

| | # File 'lib/vips/methods.rb', line 117 | | ------------------------------------------ |

#acosImage

Return the inverse cosine of an image in degrees.

1449 1450 1451 # File 'lib/vips/image.rb', line 1449 def acos math :acos end

#acoshImage

Return the inverse hyperbolic cosine of an image in radians.

1491 1492 1493 # File 'lib/vips/image.rb', line 1491 def acosh math :acosh end

#add(right, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 15 | | ----------------------------------------- |

#add_alphaImage

Append an alpha channel to an image.

974 975 976 977 978 979 980 # File 'lib/vips/image.rb', line 974 def add_alpha ptr = GenericPtr.new result = Vips.vips_addalpha self, ptr, :pointer, nil raise Vips::Error if result != 0 Vips::Image.new ptr[:value] end

#addalpha(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 588 | | ------------------------------------------ |

#affine(matrix, **opts) ⇒ Vips::Image

Affine transform of an image.

| | # File 'lib/vips/methods.rb', line 2510 | | ------------------------------------------- |

#asinImage

Return the inverse sine of an image in degrees.

1442 1443 1444 # File 'lib/vips/image.rb', line 1442 def asin math :asin end

#asinhImage

Return the inverse hyperbolic sine of an image in radians.

1484 1485 1486 # File 'lib/vips/image.rb', line 1484 def asinh math :asinh end

#atanImage

Return the inverse tangent of an image in degrees.

1456 1457 1458 # File 'lib/vips/image.rb', line 1456 def atan math :atan end

#atanhImage

Return the inverse hyperbolic tangent of an image in radians.

1498 1499 1500 # File 'lib/vips/image.rb', line 1498 def atanh math :atanh end

#autorot(**opts) ⇒ Vips::Image, Hash<Symbol => Object>

Autorotate image by exif tag.

| | # File 'lib/vips/methods.rb', line 474 | | ------------------------------------------ |

#avg(**opts) ⇒ Float

| | # File 'lib/vips/methods.rb', line 178 | | ------------------------------------------ |

#bandandImage

AND the bands of an image together

1258 1259 1260 # File 'lib/vips/image.rb', line 1258 def bandand bandbool :and end

#bandbool(boolean, **opts) ⇒ Vips::Image

Boolean operation across image bands.

| | # File 'lib/vips/methods.rb', line 442 | | ------------------------------------------ |

#bandeorImage

EOR the bands of an image together

1272 1273 1274 # File 'lib/vips/image.rb', line 1272 def bandeor bandbool :eor end

#bandfold(**opts) ⇒ Vips::Image

Fold up x axis into bands.

| | # File 'lib/vips/methods.rb', line 487 | | ------------------------------------------ |

#bandjoin(other) ⇒ Image

Join a set of images bandwise.

| 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 | # File 'lib/vips/image.rb', line 1287 def bandjoin other unless other.is_a? Array other = [other] end not_all_real = !other.all? { |x| x.is_a? Numeric } if not_all_real Vips::Image.bandjoin([self] + other) else bandjoin_const other end end | | --------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |

#bandjoin_const(c, **opts) ⇒ Vips::Image

Append a constant band to an image.

| | # File 'lib/vips/methods.rb', line 424 | | ------------------------------------------ |

#bandmean(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 437 | | ------------------------------------------ |

#bandorImage

OR the bands of an image together

1265 1266 1267 # File 'lib/vips/image.rb', line 1265 def bandor bandbool :or end

#bands ⇒ Integer

Get number of image bands.

875 876 877 # File 'lib/vips/image.rb', line 875 def bands Vips.vips_image_get_bands self end

#bandsplit ⇒ Array<Image>

Split an n-band image into n separate images.

| 1279 1280 1281 | # File 'lib/vips/image.rb', line 1279 def bandsplit (0...bands).map { |i| extract_band i } end | | -------------- | --------------------------------------------------------------------------------------------------- |

#bandunfold(**opts) ⇒ Vips::Image

Unfold image bands into x axis.

| | # File 'lib/vips/methods.rb', line 493 | | ------------------------------------------ |

#boolean(right, boolean, **opts) ⇒ Vips::Image

Boolean operation on two images.

| | # File 'lib/vips/methods.rb', line 64 | | ----------------------------------------- |

#boolean_const(boolean, c, **opts) ⇒ Vips::Image

Boolean operations against a constant.

| | # File 'lib/vips/methods.rb', line 146 | | ------------------------------------------ |

#buildlut(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 841 | | ------------------------------------------ |

#byteswap(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 561 | | ------------------------------------------ |

#canny(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2934 | | ------------------------------------------- |

#case(cases, **opts) ⇒ Vips::Image

Use pixel values to pick cases from an array of images.

| | # File 'lib/vips/methods.rb', line 2763 | | ------------------------------------------- |

#cast(format, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 455 | | ------------------------------------------ |

#ceilImage

Return the smallest integral value not less than the argument.

1244 1245 1246 # File 'lib/vips/image.rb', line 1244 def ceil round :ceil end

#clamp(**opts) ⇒ Vips::Image

Clamp values of an image.

| | # File 'lib/vips/methods.rb', line 91 | | ----------------------------------------- |

#CMC2LCh(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2593 | | ------------------------------------------- |

#CMYK2XYZ(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2740 | | ------------------------------------------- |

#coding ⇒ Symbol

896 897 898 # File 'lib/vips/image.rb', line 896 def coding get "coding" end

#colourspace(space, **opts) ⇒ Vips::Image

Convert to a new colorspace.

| | # File 'lib/vips/methods.rb', line 2559 | | ------------------------------------------- |

#compass(mask, **opts) ⇒ Vips::Image

Convolve with rotating mask.

| | # File 'lib/vips/methods.rb', line 2860 | | ------------------------------------------- |

#complex(cmplx, **opts) ⇒ Vips::Image

Perform a complex operation on an image.

| | # File 'lib/vips/methods.rb', line 160 | | ------------------------------------------ |

#complex2(right, cmplx, **opts) ⇒ Vips::Image

Complex binary operations on two images.

| | # File 'lib/vips/methods.rb', line 78 | | ----------------------------------------- |

#complexform(right, **opts) ⇒ Vips::Image

Form a complex image from two real images.

| | # File 'lib/vips/methods.rb', line 85 | | ----------------------------------------- |

#complexget(get, **opts) ⇒ Vips::Image

Get a component from a complex image.

| | # File 'lib/vips/methods.rb', line 166 | | ------------------------------------------ |

#composite(overlay, mode, **opts) ⇒ Image

Composite a set of images with a set of blend modes.

| 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 | # File 'lib/vips/image.rb', line 1313 def composite overlay, mode, **opts unless overlay.is_a? Array overlay = [overlay] end unless mode.is_a? Array mode = [mode] end mode = mode.map do |x| GObject::GValue.from_nick Vips::BLEND_MODE_TYPE, x end Vips::Image.composite([self] + overlay, mode, **opts) end | | --------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

#composite2(overlay, mode, **opts) ⇒ Vips::Image

Blend a pair of images with a blend mode.

| | # File 'lib/vips/methods.rb', line 577 | | ------------------------------------------ |

#conjImage

Return the complex conjugate of an image.

The image can be complex, in which case the return image will also be complex, or must have an even number of bands, in which case pairs of bands are treated as (x, y) coordinates.

| 1406 1407 1408 | # File 'lib/vips/image.rb', line 1406 def conj Image.run_cmplx(self) { |x| x.complex :conj } end | | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |

#conv(mask, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2831 | | ------------------------------------------- |

#conva(mask, **opts) ⇒ Vips::Image

Approximate integer convolution.

| | # File 'lib/vips/methods.rb', line 2840 | | ------------------------------------------- |

#convasep(mask, **opts) ⇒ Vips::Image

Approximate separable integer convolution.

| | # File 'lib/vips/methods.rb', line 2881 | | ------------------------------------------- |

#convf(mask, **opts) ⇒ Vips::Image

Float convolution operation.

| | # File 'lib/vips/methods.rb', line 2848 | | ------------------------------------------- |

#convi(mask, **opts) ⇒ Vips::Image

Int convolution operation.

| | # File 'lib/vips/methods.rb', line 2854 | | ------------------------------------------- |

#convsep(mask, **opts) ⇒ Vips::Image

Separable convolution operation.

| | # File 'lib/vips/methods.rb', line 2872 | | ------------------------------------------- |

#copy(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 286 | | ------------------------------------------ |

#copy_memoryImage

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 #tilecache for a way of caching parts of an image.

990 991 992 993 # File 'lib/vips/image.rb', line 990 def copy_memory new_image = Vips.vips_image_copy_memory self Vips::Image.new new_image end

#cosImage

Return the cosine of an image in degrees.

1428 1429 1430 # File 'lib/vips/image.rb', line 1428 def cos math :cos end

#coshImage

Return the hyperbolic cosine of an image in radians.

1470 1471 1472 # File 'lib/vips/image.rb', line 1470 def cosh math :cosh end

#countlines(direction, **opts) ⇒ Float

| | # File 'lib/vips/methods.rb', line 2984 | | ------------------------------------------- |

#crop(left, top, width, height, **opts) ⇒ Vips::Image

Extract an area from an image.

| | # File 'lib/vips/methods.rb', line 397 | | ------------------------------------------ |

#cross_phase(other) ⇒ Image

Calculate the cross phase of two images.

1414 1415 1416 # File 'lib/vips/image.rb', line 1414 def cross_phase other complex2 other, :cross_phase end

#csvsave(filename, **opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 1608 | | ------------------------------------------- |

#csvsave_target(target, **opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 1619 | | ------------------------------------------- |

#dE00(right, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2701 | | ------------------------------------------- |

#dE76(right, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2695 | | ------------------------------------------- |

#dECMC(right, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2707 | | ------------------------------------------- |

#deviate(**opts) ⇒ Float

Find image standard deviation.

| | # File 'lib/vips/methods.rb', line 205 | | ------------------------------------------ |

#dilate(mask) ⇒ Image

Dilate with a structuring element.

The structuring element must be an array with 0 for black, 255 for white and 128 for don't care.

1564 1565 1566 # File 'lib/vips/image.rb', line 1564 def dilate mask morph mask, :dilate end

#divide(right, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 45 | | ----------------------------------------- |

#draw_circle(ink, cx, cy, radius, **opts) ⇒ Vips::Image

Draw a circle on an image.

| | # File 'lib/vips/methods.rb', line 3032 | | ------------------------------------------- |

#draw_flood(ink, x, y, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 3042 | | ------------------------------------------- |

#draw_image(sub, x, y, **opts) ⇒ Vips::Image

Paint an image into another image.

| | # File 'lib/vips/methods.rb', line 3056 | | ------------------------------------------- |

#draw_line(ink, x1, y1, x2, y2, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 3022 | | ------------------------------------------- |

#draw_mask(ink, mask, x, y, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 3013 | | ------------------------------------------- |

#draw_point(ink, left, top, **opts) ⇒ Image

1000 1001 1002 # File 'lib/vips/image.rb', line 1000 def draw_point ink, left, top, **opts draw_rect ink, left, top, 1, 1, **opts end

#draw_rect(ink, left, top, width, height, **opts) ⇒ Vips::Image

Paint a rectangle on an image.

| | # File 'lib/vips/methods.rb', line 3002 | | ------------------------------------------- |

#draw_smudge(left, top, width, height, **opts) ⇒ Vips::Image

Blur a rectangle on an image.

| | # File 'lib/vips/methods.rb', line 3065 | | ------------------------------------------- |

#dzsave(filename, **opts) ⇒ nil

Save image to deepzoom file.

| | # File 'lib/vips/methods.rb', line 1857 | | ------------------------------------------- |

#dzsave_buffer(**opts) ⇒ VipsBlob

| | # File 'lib/vips/methods.rb', line 1881 | | ------------------------------------------- |

#dzsave_target(target, **opts) ⇒ nil

Save image to deepzoom target.

| | # File 'lib/vips/methods.rb', line 1904 | | ------------------------------------------- |

#embed(x, y, width, height, **opts) ⇒ Vips::Image

Embed an image in a larger image.

| | # File 'lib/vips/methods.rb', line 327 | | ------------------------------------------ |

#erode(mask) ⇒ Image

Erode with a structuring element.

The structuring element must be an array with 0 for black, 255 for white and 128 for don't care.

1552 1553 1554 # File 'lib/vips/image.rb', line 1552 def erode mask morph mask, :erode end

#expImage

1519 1520 1521 # File 'lib/vips/image.rb', line 1519 def exp math :exp end

#exp10Image

1526 1527 1528 # File 'lib/vips/image.rb', line 1526 def exp10 math :exp10 end

Extract an area from an image.

| | # File 'lib/vips/methods.rb', line 388 | | ------------------------------------------ |

#extract_band(band, **opts) ⇒ Vips::Image

Extract band from an image.

| | # File 'lib/vips/methods.rb', line 417 | | ------------------------------------------ |

#falsecolour(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 566 | | ------------------------------------------ |

#fastcor(ref, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2888 | | ------------------------------------------- |

#filename ⇒ String

Get image filename, if any.

903 904 905 # File 'lib/vips/image.rb', line 903 def filename get "filename" end

#fill_nearest(**opts) ⇒ Vips::Image, Hash<Symbol => Object>

Fill image zeros with nearest non-zero pixel.

| | # File 'lib/vips/methods.rb', line 2996 | | ------------------------------------------- |

#find_trim(**opts) ⇒ Array<Integer, Integer, Integer, Integer>

Search an image for non-edge areas.

| | # File 'lib/vips/methods.rb', line 278 | | ------------------------------------------ |

#fitssave(filename, **opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 2238 | | ------------------------------------------- |

#flatten(**opts) ⇒ Vips::Image

Flatten alpha out of an image.

| | # File 'lib/vips/methods.rb', line 499 | | ------------------------------------------ |

#flip(direction, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 348 | | ------------------------------------------ |

#fliphorImage

1533 1534 1535 # File 'lib/vips/image.rb', line 1533 def fliphor flip :horizontal end

#flipverImage

1540 1541 1542 # File 'lib/vips/image.rb', line 1540 def flipver flip :vertical end

#float2rad(**opts) ⇒ Vips::Image

Transform float rgb to radiance coding.

| | # File 'lib/vips/methods.rb', line 2643 | | ------------------------------------------- |

#floorImage

Return the largest integral value not greater than the argument.

1237 1238 1239 # File 'lib/vips/image.rb', line 1237 def floor round :floor end

#format ⇒ Symbol

882 883 884 # File 'lib/vips/image.rb', line 882 def format get "format" end

#freqmult(mask, **opts) ⇒ Vips::Image

Frequency-domain filtering.

| | # File 'lib/vips/methods.rb', line 2952 | | ------------------------------------------- |

#fwfft(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2941 | | ------------------------------------------- |

#gamma(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 571 | | ------------------------------------------ |

#gaussblur(sigma, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2911 | | ------------------------------------------- |

#get(name) ⇒ Object

Get a metadata item from an image. Ruby 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.

763 764 765 766 767 768 769 770 771 772 773 774 775 776 # File 'lib/vips/image.rb', line 763 def get name unless Vips.at_least_libvips?(8, 5) return super if parent_get_typeof(name) != 0 end gvalue = GObject::GValue.alloc raise Vips::Error if Vips.vips_image_get(self, name, gvalue) != 0 result = gvalue.get gvalue.unset result end

#get_fields ⇒ [String]

Get the names of all fields on an image. Use this to loop over all image metadata.

782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 # File 'lib/vips/image.rb', line 782 def get_fields return [] unless Vips.respond_to? :vips_image_get_fields array = Vips.vips_image_get_fields self names = [] p = array until (q = p.read_pointer).null? names << q.read_string GLib.g_free q p += FFI::Type::POINTER.size end GLib.g_free array names end

#get_typeof(name) ⇒ Integer

Get the GType of a metadata field. The result is 0 if no such field exists.

739 740 741 742 743 744 745 746 747 748 # File 'lib/vips/image.rb', line 739 def get_typeof name unless Vips.at_least_libvips?(8, 5) gtype = parent_get_typeof name return gtype if gtype != 0 end Vips.vips_image_get_typeof self, name end

#get_value(name) ⇒ Object

compatibility: old name for get

847 848 849 # File 'lib/vips/image.rb', line 847 def get_value name get name end

#getpoint(x, y, **opts) ⇒ Array

Read a point from an image.

| | # File 'lib/vips/methods.rb', line 270 | | ------------------------------------------ |

#gifsave(filename, **opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 1807 | | ------------------------------------------- |

#gifsave_buffer(**opts) ⇒ VipsBlob

| | # File 'lib/vips/methods.rb', line 1824 | | ------------------------------------------- |

#gifsave_target(target, **opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 1840 | | ------------------------------------------- |

#globalbalance(**opts) ⇒ Vips::Image

Global balance an image mosaic.

| | # File 'lib/vips/methods.rb', line 3148 | | ------------------------------------------- |

#gravity(direction, width, height, **opts) ⇒ Vips::Image

Place an image within a larger image with a certain gravity.

| | # File 'lib/vips/methods.rb', line 338 | | ------------------------------------------ |

#grid(tile_height, across, down, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 519 | | ------------------------------------------ |

#has_alpha? ⇒ Boolean

Detect if image has an alpha channel

964 965 966 # File 'lib/vips/image.rb', line 964 def has_alpha? Vips.vips_image_hasalpha(self) != 0 end

#heifsave(filename, **opts) ⇒ nil

Save image in heif format.

| | # File 'lib/vips/methods.rb', line 2258 | | ------------------------------------------- |

#heifsave_buffer(**opts) ⇒ VipsBlob

Save image in heif format.

| | # File 'lib/vips/methods.rb', line 2275 | | ------------------------------------------- |

#heifsave_target(target, **opts) ⇒ nil

Save image in heif format.

| | # File 'lib/vips/methods.rb', line 2291 | | ------------------------------------------- |

#height ⇒ Integer

Get image height, in pixels.

868 869 870 # File 'lib/vips/image.rb', line 868 def height Vips.vips_image_get_height self end

#hist_cum(**opts) ⇒ Vips::Image

Form cumulative histogram.

| | # File 'lib/vips/methods.rb', line 2786 | | ------------------------------------------- |

#hist_entropy(**opts) ⇒ Float

| | # File 'lib/vips/methods.rb', line 2826 | | ------------------------------------------- |

#hist_equal(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2802 | | ------------------------------------------- |

#hist_find(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 215 | | ------------------------------------------ |

#hist_find_indexed(index, **opts) ⇒ Vips::Image

Find indexed image histogram.

| | # File 'lib/vips/methods.rb', line 227 | | ------------------------------------------ |

#hist_find_ndim(**opts) ⇒ Vips::Image

Find n-dimensional image histogram.

| | # File 'lib/vips/methods.rb', line 221 | | ------------------------------------------ |

#hist_ismonotonic(**opts) ⇒ Boolean

| | # File 'lib/vips/methods.rb', line 2821 | | ------------------------------------------- |

#hist_local(width, height, **opts) ⇒ Vips::Image

Local histogram equalisation.

| | # File 'lib/vips/methods.rb', line 2813 | | ------------------------------------------- |

#hist_match(ref, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2791 | | ------------------------------------------- |

#hist_norm(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2797 | | ------------------------------------------- |

#hist_plot(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2808 | | ------------------------------------------- |

#hough_circle(**opts) ⇒ Vips::Image

Find hough circle transform.

| | # File 'lib/vips/methods.rb', line 241 | | ------------------------------------------ |

#hough_line(**opts) ⇒ Vips::Image

Find hough line transform.

| | # File 'lib/vips/methods.rb', line 234 | | ------------------------------------------ |

#HSV2sRGB(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2658 | | ------------------------------------------- |

#icc_export(**opts) ⇒ Vips::Image

Output to device with icc profile.

| | # File 'lib/vips/methods.rb', line 2673 | | ------------------------------------------- |

#icc_import(**opts) ⇒ Vips::Image

Import from device with icc profile.

| | # File 'lib/vips/methods.rb', line 2663 | | ------------------------------------------- |

#icc_transform(output_profile, **opts) ⇒ Vips::Image

Transform between devices with icc profiles.

| | # File 'lib/vips/methods.rb', line 2683 | | ------------------------------------------- |

#ifthenelse(th, el, **opts) ⇒ Image

Select pixels from th if self is non-zero and from el ifself is zero. Use the :blend option to fade smoothly between th and el.

| 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 | # File 'lib/vips/image.rb', line 1598 def ifthenelse(th, el, **opts) match_image = [th, el, self].find { |x| x.is_a? Vips::Image } unless th.is_a? Vips::Image th = Operation.imageize match_image, th end unless el.is_a? Vips::Image el = Operation.imageize match_image, el end Vips::Operation.call "ifthenelse", [self, th, el], opts end | | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

#imagImage

Return the imaginary part of a complex image.

1368 1369 1370 # File 'lib/vips/image.rb', line 1368 def imag complexget :imag end

#insert(sub, x, y, **opts) ⇒ Vips::Image

Insert image @sub into @main at @x, @y.

| | # File 'lib/vips/methods.rb', line 354 | | ------------------------------------------ |

#inspectObject

194 195 196 # File 'lib/vips/image.rb', line 194 def inspect "#<Image #{width}x#{height} #{format}, #{bands} bands, #{interpretation}>" end

#interpretation ⇒ Symbol

Get image interpretation.

889 890 891 # File 'lib/vips/image.rb', line 889 def interpretation get "interpretation" end

#invert(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 98 | | ----------------------------------------- |

#invertlut(**opts) ⇒ Vips::Image

Build an inverted look-up table.

| | # File 'lib/vips/methods.rb', line 846 | | ------------------------------------------ |

#invfft(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2946 | | ------------------------------------------- |

#join(in2, direction, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 364 | | ------------------------------------------ |

#jp2ksave(filename, **opts) ⇒ nil

Save image in jpeg2000 format.

| | # File 'lib/vips/methods.rb', line 1763 | | ------------------------------------------- |

#jp2ksave_buffer(**opts) ⇒ VipsBlob

Save image in jpeg2000 format.

| | # File 'lib/vips/methods.rb', line 1778 | | ------------------------------------------- |

#jp2ksave_target(target, **opts) ⇒ nil

Save image in jpeg2000 format.

| | # File 'lib/vips/methods.rb', line 1792 | | ------------------------------------------- |

#jpegsave(filename, **opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 1981 | | ------------------------------------------- |

#jpegsave_buffer(**opts) ⇒ VipsBlob

Save image to jpeg buffer.

| | # File 'lib/vips/methods.rb', line 2000 | | ------------------------------------------- |

#jpegsave_mime(**opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 2037 | | ------------------------------------------- |

#jpegsave_target(target, **opts) ⇒ nil

Save image to jpeg target.

| | # File 'lib/vips/methods.rb', line 2018 | | ------------------------------------------- |

#jxlsave(filename, **opts) ⇒ nil

Save image in jpeg-xl format.

| | # File 'lib/vips/methods.rb', line 2308 | | ------------------------------------------- |

#jxlsave_buffer(**opts) ⇒ VipsBlob

Save image in jpeg-xl format.

| | # File 'lib/vips/methods.rb', line 2323 | | ------------------------------------------- |

#jxlsave_target(target, **opts) ⇒ nil

Save image in jpeg-xl format.

| | # File 'lib/vips/methods.rb', line 2337 | | ------------------------------------------- |

#Lab2LabQ(**opts) ⇒ Vips::Image

Transform float lab to labq coding.

| | # File 'lib/vips/methods.rb', line 2613 | | ------------------------------------------- |

#Lab2LabS(**opts) ⇒ Vips::Image

Transform float lab to signed short.

| | # File 'lib/vips/methods.rb', line 2633 | | ------------------------------------------- |

#Lab2LCh(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2578 | | ------------------------------------------- |

#Lab2XYZ(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2566 | | ------------------------------------------- |

#labelregions(**opts) ⇒ Vips::Image, Hash<Symbol => Object>

Label regions in an image.

| | # File 'lib/vips/methods.rb', line 2990 | | ------------------------------------------- |

#LabQ2Lab(**opts) ⇒ Vips::Image

Unpack a labq image to float lab.

| | # File 'lib/vips/methods.rb', line 2608 | | ------------------------------------------- |

#LabQ2LabS(**opts) ⇒ Vips::Image

Unpack a labq image to short lab.

| | # File 'lib/vips/methods.rb', line 2618 | | ------------------------------------------- |

#LabQ2sRGB(**opts) ⇒ Vips::Image

Convert a labq image to srgb.

| | # File 'lib/vips/methods.rb', line 2648 | | ------------------------------------------- |

#LabS2Lab(**opts) ⇒ Vips::Image

Transform signed short lab to float.

| | # File 'lib/vips/methods.rb', line 2628 | | ------------------------------------------- |

#LabS2LabQ(**opts) ⇒ Vips::Image

Transform short lab to labq coding.

| | # File 'lib/vips/methods.rb', line 2623 | | ------------------------------------------- |

#LCh2CMC(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2588 | | ------------------------------------------- |

#LCh2Lab(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2583 | | ------------------------------------------- |

#linear(a, b, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 103 | | ------------------------------------------ |

#linecache(**opts) ⇒ Vips::Image

Cache an image as a set of lines.

| | # File 'lib/vips/methods.rb', line 312 | | ------------------------------------------ |

#logImage

Return the natural log of an image.

1505 1506 1507 # File 'lib/vips/image.rb', line 1505 def log math :log end

#log10Image

Return the log base 10 of an image.

1512 1513 1514 # File 'lib/vips/image.rb', line 1512 def log10 math :log10 end

#magicksave(filename, **opts) ⇒ nil

Save file with imagemagick.

| | # File 'lib/vips/methods.rb', line 2352 | | ------------------------------------------- |

#magicksave_buffer(**opts) ⇒ VipsBlob

Save image to magick buffer.

| | # File 'lib/vips/methods.rb', line 2367 | | ------------------------------------------- |

#mapim(index, **opts) ⇒ Vips::Image

Resample with a map image.

| | # File 'lib/vips/methods.rb', line 2446 | | ------------------------------------------- |

#maplut(lut, **opts) ⇒ Vips::Image

Map an image though a lut.

| | # File 'lib/vips/methods.rb', line 2756 | | ------------------------------------------- |

#match(sec, xr1, yr1, xs1, ys1, xr2, yr2, xs2, ys2, **opts) ⇒ Vips::Image

First-order match of two images.

| | # File 'lib/vips/methods.rb', line 3130 | | ------------------------------------------- |

#math(math, **opts) ⇒ Vips::Image

Apply a math operation to an image.

| | # File 'lib/vips/methods.rb', line 111 | | ------------------------------------------ |

#math2(right, math2, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 71 | | ----------------------------------------- |

#math2_const(math2, c, **opts) ⇒ Vips::Image

Binary math operations with a constant.

| | # File 'lib/vips/methods.rb', line 153 | | ------------------------------------------ |

#matrixinvert(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 3125 | | ------------------------------------------- |

#matrixprint(**opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 1650 | | ------------------------------------------- |

#matrixsave(filename, **opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 1630 | | ------------------------------------------- |

#matrixsave_target(target, **opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 1640 | | ------------------------------------------- |

#max(**opts) ⇒ Float, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 194 | | ------------------------------------------ |

#maxpair(right, **opts) ⇒ Vips::Image

Maximum of a pair of images.

| | # File 'lib/vips/methods.rb', line 27 | | ----------------------------------------- |

#maxpos ⇒ Real

Return the coordinates of the image maximum.

1332 1333 1334 1335 1336 1337 # File 'lib/vips/image.rb', line 1332 def maxpos v, opts = max x: true, y: true x = opts["x"] y = opts["y"] [v, x, y] end

#measure(h, v, **opts) ⇒ Vips::Image

Measure a set of patches on a color chart.

| | # File 'lib/vips/methods.rb', line 259 | | ------------------------------------------ |

#median(size = 3) ⇒ Image

1354 1355 1356 # File 'lib/vips/image.rb', line 1354 def median size = 3 rank size, size, size**2 / 2 end

#merge(sec, direction, dx, dy, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 3074 | | ------------------------------------------- |

#min(**opts) ⇒ Float, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 183 | | ------------------------------------------ |

#minpair(right, **opts) ⇒ Vips::Image

Minimum of a pair of images.

| | # File 'lib/vips/methods.rb', line 21 | | ----------------------------------------- |

#minpos ⇒ Real

Return the coordinates of the image minimum.

1343 1344 1345 1346 1347 1348 # File 'lib/vips/image.rb', line 1343 def minpos v, opts = min x: true, y: true x = opts["x"] y = opts["y"] [v, x, y] end

#morph(mask, morph, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2969 | | ------------------------------------------- |

#mosaic(sec, direction, xref, yref, xsec, ysec, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

| | # File 'lib/vips/methods.rb', line 3084 | | ------------------------------------------- |

#mosaic1(sec, direction, xr1, yr1, xs1, ys1, xr2, yr2, xs2, ys2, **opts) ⇒ Vips::Image

First-order mosaic of two images.

| | # File 'lib/vips/methods.rb', line 3105 | | ------------------------------------------- |

#msb(**opts) ⇒ Vips::Image

Pick most-significant byte from an image.

| | # File 'lib/vips/methods.rb', line 555 | | ------------------------------------------ |

#multiply(right, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 39 | | ----------------------------------------- |

#mutate {|mutable| ... } ⇒ Object

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, x.width * i, 0, 0, x.height * (1 - i)
  end
end

See MutableImage.

815 816 817 818 819 # File 'lib/vips/image.rb', line 815 def mutate mutable = Vips::MutableImage.new self yield mutable mutable.image end

#new_from_image(value) ⇒ 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.

555 556 557 558 559 560 # File 'lib/vips/image.rb', line 555 def new_from_image value pixel = (Vips::Image.black(1, 1) + value).cast(format) image = pixel.embed 0, 0, width, height, extend: :copy image.copy interpretation: interpretation, xres: xres, yres: yres, xoffset: xoffset, yoffset: yoffset end

#niftisave(filename, **opts) ⇒ nil

Save image to nifti file.

| | # File 'lib/vips/methods.rb', line 2248 | | ------------------------------------------- |

#offset ⇒ Float

947 948 949 950 951 # File 'lib/vips/image.rb', line 947 def offset return 0 if get_typeof("offset") == 0 get "offset" end

#parent_get_typeofObject

79 # File 'lib/vips/image.rb', line 79 alias_method :parent_get_typeof, :get_typeof

#percent(percent, **opts) ⇒ Integer

Find threshold for percent of pixels.

| | # File 'lib/vips/methods.rb', line 2769 | | ------------------------------------------- |

#phasecor(in2, **opts) ⇒ Vips::Image

Calculate phase correlation.

| | # File 'lib/vips/methods.rb', line 2963 | | ------------------------------------------- |

#pngsave(filename, **opts) ⇒ nil

Save image to file as png.

| | # File 'lib/vips/methods.rb', line 1928 | | ------------------------------------------- |

#pngsave_buffer(**opts) ⇒ VipsBlob

Save image to buffer as png.

| | # File 'lib/vips/methods.rb', line 1946 | | ------------------------------------------- |

#pngsave_target(target, **opts) ⇒ nil

Save image to target as png.

| | # File 'lib/vips/methods.rb', line 1963 | | ------------------------------------------- |

#polarImage

Return an image with rectangular pixels converted to polar.

The image can be complex, in which case the return image will also be complex, or must have an even number of bands, in which case pairs of bands are treated as (x, y) coordinates.

| 1381 1382 1383 | # File 'lib/vips/image.rb', line 1381 def polar Image.run_cmplx(self) { |x| x.complex :polar } end | | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |

#ppmsave(filename, **opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 1708 | | ------------------------------------------- |

#ppmsave_target(target, **opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 1721 | | ------------------------------------------- |

#premultiply(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 506 | | ------------------------------------------ |

#prewitt(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2929 | | ------------------------------------------- |

#quadratic(coeff, **opts) ⇒ Vips::Image

Resample an image with a quadratic transform.

| | # File 'lib/vips/methods.rb', line 2503 | | ------------------------------------------- |

#rad2float(**opts) ⇒ Vips::Image

Unpack radiance coding to float rgb.

| | # File 'lib/vips/methods.rb', line 2638 | | ------------------------------------------- |

#radsave(filename, **opts) ⇒ nil

Save image to radiance file.

| | # File 'lib/vips/methods.rb', line 1734 | | ------------------------------------------- |

#radsave_buffer(**opts) ⇒ VipsBlob

Save image to radiance buffer.

| | # File 'lib/vips/methods.rb', line 1744 | | ------------------------------------------- |

#radsave_target(target, **opts) ⇒ nil

Save image to radiance target.

| | # File 'lib/vips/methods.rb', line 1753 | | ------------------------------------------- |

#rank(width, height, index, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2976 | | ------------------------------------------- |

#rawsave(filename, **opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 1659 | | ------------------------------------------- |

#rawsave_buffer(**opts) ⇒ VipsBlob

Write raw image to buffer.

| | # File 'lib/vips/methods.rb', line 1669 | | ------------------------------------------- |

#rawsave_target(target, **opts) ⇒ nil

Write raw image to target.

| | # File 'lib/vips/methods.rb', line 1678 | | ------------------------------------------- |

#realImage

Return the real part of a complex image.

1361 1362 1363 # File 'lib/vips/image.rb', line 1361 def real complexget :real end

#recomb(m, **opts) ⇒ Vips::Image

Linear recombination with matrix.

| | # File 'lib/vips/methods.rb', line 481 | | ------------------------------------------ |

#rectImage

Return an image with polar pixels converted to rectangular.

The image can be complex, in which case the return image will also be complex, or must have an even number of bands, in which case pairs of bands are treated as (x, y) coordinates.

| 1394 1395 1396 | # File 'lib/vips/image.rb', line 1394 def rect Image.run_cmplx(self) { |x| x.complex :rect } end | | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |

#reduce(hshrink, vshrink, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2494 | | ------------------------------------------- |

#reduceh(hshrink, **opts) ⇒ Vips::Image

Shrink an image horizontally.

| | # File 'lib/vips/methods.rb', line 2478 | | ------------------------------------------- |

#reducev(vshrink, **opts) ⇒ Vips::Image

Shrink an image vertically.

| | # File 'lib/vips/methods.rb', line 2486 | | ------------------------------------------- |

#relational(right, relational, **opts) ⇒ Vips::Image

Relational operation on two images.

| | # File 'lib/vips/methods.rb', line 51 | | ----------------------------------------- |

#relational_const(relational, c, **opts) ⇒ Vips::Image

Relational operations against a constant.

| | # File 'lib/vips/methods.rb', line 133 | | ------------------------------------------ |

#remainder(right, **opts) ⇒ Vips::Image

Remainder after integer division of two images.

| | # File 'lib/vips/methods.rb', line 58 | | ----------------------------------------- |

#remainder_const(c, **opts) ⇒ Vips::Image

Remainder after integer division of an image and a constant.

| | # File 'lib/vips/methods.rb', line 140 | | ------------------------------------------ |

#remove(name) ⇒ Object

842 843 844 # File 'lib/vips/image.rb', line 842 def remove name Vips.vips_image_remove self, name end

#replicate(across, down, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 448 | | ------------------------------------------ |

#resize(scale, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2550 | | ------------------------------------------- |

#respond_to?(name, include_all = false) ⇒ Boolean

198 199 200 201 202 203 204 205 206 207 # File 'lib/vips/image.rb', line 198 def respond_to? name, include_all = false return false if name == :to_hash super end

#respond_to_missing?(name, include_all = false) ⇒ Boolean

209 210 211 212 213 214 # File 'lib/vips/image.rb', line 209 def respond_to_missing? name, include_all = false return true if Vips.type_find("VipsOperation", name.to_s) != 0 super end

#rintImage

Return the nearest integral value.

1251 1252 1253 # File 'lib/vips/image.rb', line 1251 def rint round :rint end

#rot(angle, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 462 | | ------------------------------------------ |

#rot180Image

Rotate by 180 degrees clockwise.

1578 1579 1580 # File 'lib/vips/image.rb', line 1578 def rot180 rot :d180 end

#rot270Image

Rotate by 270 degrees clockwise.

1585 1586 1587 # File 'lib/vips/image.rb', line 1585 def rot270 rot :d270 end

#rot45(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 468 | | ------------------------------------------ |

#rot90Image

Rotate by 90 degrees clockwise.

1571 1572 1573 # File 'lib/vips/image.rb', line 1571 def rot90 rot :d90 end

#rotate(angle, **opts) ⇒ Vips::Image

Rotate an image by a number of degrees.

| | # File 'lib/vips/methods.rb', line 2538 | | ------------------------------------------- |

#round(round, **opts) ⇒ Vips::Image

Perform a round function on an image.

| | # File 'lib/vips/methods.rb', line 127 | | ------------------------------------------ |

#scale ⇒ Float

938 939 940 941 942 # File 'lib/vips/image.rb', line 938 def scale return 1 if get_typeof("scale") == 0 get "scale" end

#scaleimage(**opts) ⇒ Vips::Image

Scale an image to uchar. This is the vips scale operation, but renamed to avoid a clash with the .scale property.

1616 1617 1618 # File 'lib/vips/image.rb', line 1616 def scaleimage **opts Vips::Image.scale self, **opts end

#scharr(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2924 | | ------------------------------------------- |

#scRGB2BW(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2723 | | ------------------------------------------- |

#scRGB2sRGB(**opts) ⇒ Vips::Image

Convert an scrgb image to srgb.

| | # File 'lib/vips/methods.rb', line 2734 | | ------------------------------------------- |

#scRGB2XYZ(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2718 | | ------------------------------------------- |

#sequential(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 321 | | ------------------------------------------ |

#set(name, value) ⇒ Object

835 836 837 # File 'lib/vips/image.rb', line 835 def set name, value set_type get_typeof(name), name, value end

#set_kill(kill) ⇒ Object

Kill computation of this time.

Set true to stop computation of this image. You can call this from a progress handler, for example.

729 730 731 # File 'lib/vips/image.rb', line 729 def set_kill kill Vips.vips_image_set_kill(self, kill ? 1 : 0) end

#set_progress(state) ⇒ Object

Turn progress signalling on and off.

If this is on, the most-downstream image from this image will issue progress signals.

718 719 720 # File 'lib/vips/image.rb', line 718 def set_progress state Vips.vips_image_set_progress(self, state ? 1 : 0) end

#set_type(gtype, name, value) ⇒ Object

824 825 826 827 828 829 830 # File 'lib/vips/image.rb', line 824 def set_type gtype, name, value gvalue = GObject::GValue.alloc gvalue.init gtype gvalue.set value Vips.vips_image_set self, name, gvalue gvalue.unset end

#set_value(name, value) ⇒ Object

854 855 856 # File 'lib/vips/image.rb', line 854 def set_value name, value set name, value end

#sharpen(**opts) ⇒ Vips::Image

Unsharp masking for print.

| | # File 'lib/vips/methods.rb', line 2900 | | ------------------------------------------- |

#shrink(hshrink, vshrink, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2456 | | ------------------------------------------- |

#shrinkh(hshrink, **opts) ⇒ Vips::Image

Shrink an image horizontally.

| | # File 'lib/vips/methods.rb', line 2464 | | ------------------------------------------- |

#shrinkv(vshrink, **opts) ⇒ Vips::Image

Shrink an image vertically.

| | # File 'lib/vips/methods.rb', line 2471 | | ------------------------------------------- |

#sign(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 122 | | ------------------------------------------ |

#similarity(**opts) ⇒ Vips::Image

Similarity transform of an image.

| | # File 'lib/vips/methods.rb', line 2525 | | ------------------------------------------- |

#sinImage

Return the sine of an image in degrees.

1421 1422 1423 # File 'lib/vips/image.rb', line 1421 def sin math :sin end

#sinhImage

Return the hyperbolic sine of an image in radians.

1463 1464 1465 # File 'lib/vips/image.rb', line 1463 def sinh math :sinh end

#size ⇒ Integer

956 957 958 # File 'lib/vips/image.rb', line 956 def size [width, height] end

#smartcrop(width, height, **opts) ⇒ Vips::Image, Hash<Symbol => Object>

Extract an area from an image.

| | # File 'lib/vips/methods.rb', line 406 | | ------------------------------------------ |

#sobel(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2919 | | ------------------------------------------- |

#spcor(ref, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2894 | | ------------------------------------------- |

#spectrum(**opts) ⇒ Vips::Image

Make displayable power spectrum.

| | # File 'lib/vips/methods.rb', line 2958 | | ------------------------------------------- |

#sRGB2HSV(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2653 | | ------------------------------------------- |

#sRGB2scRGB(**opts) ⇒ Vips::Image

Convert an srgb image to scrgb.

| | # File 'lib/vips/methods.rb', line 2713 | | ------------------------------------------- |

#stats(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 210 | | ------------------------------------------ |

#stdif(width, height, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2775 | | ------------------------------------------- |

#subsample(xfac, yfac, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 547 | | ------------------------------------------ |

#subtract(right, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 33 | | ----------------------------------------- |

#tanImage

Return the tangent of an image in degrees.

1435 1436 1437 # File 'lib/vips/image.rb', line 1435 def tan math :tan end

#tanhImage

Return the hyperbolic tangent of an image in radians.

1477 1478 1479 # File 'lib/vips/image.rb', line 1477 def tanh math :tanh end

#thumbnail_image(width, **opts) ⇒ Vips::Image

Generate thumbnail from image.

| | # File 'lib/vips/methods.rb', line 2414 | | ------------------------------------------- |

#tiffsave(filename, **opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 2149 | | ------------------------------------------- |

#tiffsave_buffer(**opts) ⇒ VipsBlob

Save image to tiff buffer.

| | # File 'lib/vips/methods.rb', line 2179 | | ------------------------------------------- |

#tiffsave_target(target, **opts) ⇒ nil

Save image to tiff target.

| | # File 'lib/vips/methods.rb', line 2208 | | ------------------------------------------- |

#tilecache(**opts) ⇒ Vips::Image

Cache an image as a set of tiles.

| | # File 'lib/vips/methods.rb', line 301 | | ------------------------------------------ |

#to_a ⇒ Array

Convert to an Array. This will be slow for large images.

1230 1231 1232 # File 'lib/vips/image.rb', line 1230 def to_a to_enum.to_a end

#to_enum ⇒ Enumerator

Convert to an Enumerator. Similar to #to_a but lazier.

1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 # File 'lib/vips/image.rb', line 1201 def to_enum template = { char: "c", uchar: "C", short: "s_", ushort: "S_", int: "i_", uint: "I_", float: "f", double: "d", complex: "f", dpcomplex: "d" }[format] + "*" array = write_to_memory.unpack template pixel_array = array.each_slice bands pixel_array.each_slice width end

#transpose3d(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 527 | | ------------------------------------------ |

#unpremultiply(**opts) ⇒ Vips::Image

Unpremultiply image alpha.

| | # File 'lib/vips/methods.rb', line 512 | | ------------------------------------------ |

#vipssave(filename, **opts) ⇒ nil

Save image to file in vips format.

| | # File 'lib/vips/methods.rb', line 1688 | | ------------------------------------------- |

#vipssave_target(target, **opts) ⇒ nil

Save image to target in vips format.

| | # File 'lib/vips/methods.rb', line 1698 | | ------------------------------------------- |

#webpsave(filename, **opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 2055 | | ------------------------------------------- |

#webpsave_buffer(**opts) ⇒ VipsBlob

| | # File 'lib/vips/methods.rb', line 2079 | | ------------------------------------------- |

#webpsave_mime(**opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 2126 | | ------------------------------------------- |

#webpsave_target(target, **opts) ⇒ nil

| | # File 'lib/vips/methods.rb', line 2102 | | ------------------------------------------- |

#width ⇒ Integer

Get image width, in pixels.

861 862 863 # File 'lib/vips/image.rb', line 861 def width Vips.vips_image_get_width self end

#wrap(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 533 | | ------------------------------------------ |

#write_to_buffer(format_string, **opts) ⇒ String

Write this image to a memory buffer. Save options may be encoded in the format_string or given as a hash. For example:

buffer = image.write_to_buffer ".jpg[Q=90]"

or equivalently:

image.write_to_buffer ".jpg", Q: 90

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.

629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 # File 'lib/vips/image.rb', line 629 def write_to_buffer format_string, **opts raise Vips::Error, "filename is nil" if format_string.nil? filename = Vips.p2str(Vips.vips_filename_get_filename(format_string)) option_string = Vips.p2str(Vips.vips_filename_get_options(format_string)) saver = nil if Vips.at_least_libvips?(8, 9) Vips.vips_error_freeze saver = Vips.vips_foreign_find_save_target filename Vips.vips_error_thaw end if !saver.nil? target = Vips::Target.new_to_memory Vips::Operation.call saver, [self, target], opts, option_string buffer = target.get("blob") else saver = Vips.vips_foreign_find_save_buffer filename raise Vips::Error if saver.nil? buffer = Vips::Operation.call saver, [self], opts, option_string raise Vips::Error if buffer.nil? end write_gc buffer end

#write_to_file(name, **opts) ⇒ Object

Write this image to a file. Save options may be encoded in the filename or given as a hash. For example:

image.write_to_file "fred.jpg[Q=90]"

or equivalently:

image.write_to_file "fred.jpg", Q: 90

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.

591 592 593 594 595 596 597 598 599 600 601 602 # File 'lib/vips/image.rb', line 591 def write_to_file name, **opts raise Vips::Error, "filename is nil" if name.nil? filename = Vips.p2str(Vips.vips_filename_get_filename(name)) option_string = Vips.p2str(Vips.vips_filename_get_options(name)) saver = Vips.vips_foreign_find_save filename raise Vips::Error if saver.nil? Vips::Operation.call saver, [self, filename], opts, option_string write_gc end

#write_to_memory ⇒ String

Write this image to a large memory buffer.

700 701 702 703 704 705 706 707 708 709 # File 'lib/vips/image.rb', line 700 def write_to_memory len = Vips::SizeStruct.new ptr = Vips.vips_image_write_to_memory self, len raise Vips::Error if ptr.nil? ptr = FFI::AutoPointer.new(ptr, GLib::G_FREE) ptr.get_bytes 0, len[:value] end

#write_to_target(target, format_string, **opts) ⇒ Object

Write this image to a target. Save options may be encoded in the format_string or given as a hash. For example:

target = Vips::Target.new_to_file "k2.jpg"
image.write_to_target target, ".jpg[Q=90]"

or equivalently:

image.write_to_target target, ".jpg", Q: 90

The full set of save options depend on the selected saver. Try something like:

$ vips jpegsave_target

to see all the available options for JPEG save.

686 687 688 689 690 691 692 693 694 695 # File 'lib/vips/image.rb', line 686 def write_to_target target, format_string, **opts raise Vips::Error, "filename is nil" if format_string.nil? filename = Vips.p2str(Vips.vips_filename_get_filename(format_string)) option_string = Vips.p2str(Vips.vips_filename_get_options(format_string)) saver = Vips.vips_foreign_find_save_target filename raise Vips::Error if saver.nil? Vips::Operation.call saver, [self, target], opts, option_string write_gc end

#xoffset ⇒ Integer

910 911 912 # File 'lib/vips/image.rb', line 910 def xoffset get "xoffset" end

#xres ⇒ Float

924 925 926 # File 'lib/vips/image.rb', line 924 def xres get "xres" end

#XYZ2CMYK(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2745 | | ------------------------------------------- |

#XYZ2Lab(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2572 | | ------------------------------------------- |

#XYZ2scRGB(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2729 | | ------------------------------------------- |

#XYZ2Yxy(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2598 | | ------------------------------------------- |

#yoffset ⇒ Integer

917 918 919 # File 'lib/vips/image.rb', line 917 def yoffset get "yoffset" end

#yres ⇒ Float

931 932 933 # File 'lib/vips/image.rb', line 931 def yres get "yres" end

#Yxy2XYZ(**opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 2603 | | ------------------------------------------- |

#zoom(xfac, yfac, **opts) ⇒ Vips::Image

| | # File 'lib/vips/methods.rb', line 540 | | ------------------------------------------ |

#|(other) ⇒ Image

Integer bitwise OR with an image, constant or array.

1077 1078 1079 # File 'lib/vips/image.rb', line 1077 def | other call_enum "boolean", other, :or end

#~Image

1107 1108 1109 # File 'lib/vips/image.rb', line 1107 def ~ self ^ -1 end