diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5492d03..a7216f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,13 +1,6 @@ name: Test -on: - push: - branches: - - master - pull_request: - pull_request_target: - branches: - - master +on: [push, pull_request] env: NOKOGIRI_USE_SYSTEM_LIBRARIES: true @@ -36,10 +29,8 @@ jobs: strategy: matrix: - os-version: [ 'ubuntu-20.04' ] + os-version: [ 'ubuntu-24.04' ] ruby-version: - - '2.1' - - '2.2' - '2.3' - '2.4' - '2.5' @@ -64,19 +55,11 @@ jobs: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true - - name: Update apt - env: - DEBIAN_FRONTEND: noninteractive - run: - sudo apt-get update -qq -o Acquire::Retries=3 - - name: Install libvips - env: - DEBIAN_FRONTEND: noninteractive - run: + run: | + sudo apt-get update # we only need the library - sudo apt-get install --fix-missing -qq -o Acquire::Retries=3 - libvips + sudo apt-get install --no-install-recommends libvips - name: Run Tests run: bundle exec rake spec diff --git a/CHANGELOG.md b/CHANGELOG.md index 38a12a4..876f8fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ ## master +## Version 2.2.3 (2025-02-06) + +* fix `Image#add_alpha()` with libvips 8.16 [kleisauke] +* fix FFI function definitions for `gboolean` parameters [kleisauke] + +## Version 2.2.2 (2024-07-17) + * fix compat with unified (semistatic) libvips binaries [kleisauke] ## Version 2.2.1 (2024-02-21) diff --git a/VERSION b/VERSION index c043eea..5859406 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.1 +2.2.3 diff --git a/lib/vips.rb b/lib/vips.rb index 45c103d..aed3f1a 100644 --- a/lib/vips.rb +++ b/lib/vips.rb @@ -48,7 +48,7 @@ module Vips begin attach_function :g_malloc, [:size_t], :pointer @@is_unified = true - rescue => e + rescue FFI::NotFoundError @@is_unified = false end @@ -66,7 +66,7 @@ class << self extend FFI::Library - if Vips::unified? + if Vips.unified? ffi_lib library_name("vips", 42) else ffi_lib library_name("glib-2.0", 0) @@ -162,7 +162,7 @@ def self.set_log_domain domain module GObject extend FFI::Library - if Vips::unified? + if Vips.unified? ffi_lib library_name("vips", 42) else ffi_lib library_name("gobject-2.0", 0) @@ -601,7 +601,7 @@ module GObject module Vips # we've already opened the libvips library - + LOG_DOMAIN = "VIPS" GLib.set_log_domain LOG_DOMAIN @@ -810,13 +810,13 @@ def self.at_least_libvips?(x, y) end if at_least_libvips?(8, 13) - attach_function :vips_block_untrusted_set, [:bool], :void - attach_function :vips_operation_block_set, %i[string bool], :void + attach_function :vips_block_untrusted_set, [:int], :void + attach_function :vips_operation_block_set, [:string, :int], :void # Block/unblock all untrusted operations from running. # Use `vips -l` at the command-line to see the class hierarchy and which operations are marked as untrusted. - def self.block_untrusted(enabled) - vips_block_untrusted_set(enabled) + def self.block_untrusted(state) + vips_block_untrusted_set(state ? 1 : 0) end # Block/unblock all operations in the libvips class hierarchy at specified *operation_name* and below. @@ -829,8 +829,8 @@ def self.block_untrusted(enabled) # Use `vips -l` at the command-line to see the class hierarchy. # This call does nothing if the named operation is not found. # - def self.block(operation_name, enabled) - vips_operation_block_set(operation_name, enabled) + def self.block(operation_name, state) + vips_operation_block_set(operation_name, state ? 1 : 0) end end diff --git a/lib/vips/image.rb b/lib/vips/image.rb index 45bd2ed..ea8b1af 100644 --- a/lib/vips/image.rb +++ b/lib/vips/image.rb @@ -14,8 +14,8 @@ module Vips attach_function :vips_image_copy_memory, [:pointer], :pointer - attach_function :vips_image_set_progress, [:pointer, :bool], :void - attach_function :vips_image_set_kill, [:pointer, :bool], :void + attach_function :vips_image_set_progress, [:pointer, :int], :void + attach_function :vips_image_set_kill, [:pointer, :int], :void attach_function :vips_filename_get_filename, [:string], :pointer attach_function :vips_filename_get_options, [:string], :pointer @@ -716,7 +716,7 @@ def write_to_memory # @see Object#signal_connect # @param state [Boolean] progress signalling state def set_progress state - Vips.vips_image_set_progress self, state + Vips.vips_image_set_progress(self, state ? 1 : 0) end # Kill computation of this time. @@ -727,7 +727,7 @@ def set_progress state # @see Object#signal_connect # @param kill [Boolean] stop computation def set_kill kill - Vips.vips_image_set_kill self, kill + Vips.vips_image_set_kill(self, kill ? 1 : 0) end # Get the `GType` of a metadata field. The result is 0 if no such field @@ -973,7 +973,7 @@ def has_alpha? # @return [Image] new image def add_alpha ptr = GenericPtr.new - result = Vips.vips_addalpha self, ptr + result = Vips.vips_addalpha self, ptr, :pointer, nil raise Vips::Error if result != 0 Vips::Image.new ptr[:value] diff --git a/lib/vips/methods.rb b/lib/vips/methods.rb index 2a436b2..a514d71 100644 --- a/lib/vips/methods.rb +++ b/lib/vips/methods.rb @@ -18,6 +18,18 @@ class Image # @param opts [Hash] Set of options # @return [Vips::Image] Output image +# @!method minpair(right, **opts) +# Minimum of a pair of images. +# @param right [Vips::Image] Right-hand image argument +# @param opts [Hash] Set of options +# @return [Vips::Image] Output image + +# @!method maxpair(right, **opts) +# Maximum of a pair of images. +# @param right [Vips::Image] Right-hand image argument +# @param opts [Hash] Set of options +# @return [Vips::Image] Output image + # @!method subtract(right, **opts) # Subtract two images. # @param right [Vips::Image] Right-hand image argument @@ -76,10 +88,11 @@ class Image # @param opts [Hash] Set of options # @return [Vips::Image] Output image -# @!method self.sum(im, **opts) -# Sum an array of images. -# @param im [Array] Array of input images +# @!method clamp(**opts) +# Clamp values of an image. # @param opts [Hash] Set of options +# @option opts [Float] :min Minimum value +# @option opts [Float] :max Maximum value # @return [Vips::Image] Output image # @!method invert(**opts) @@ -156,6 +169,12 @@ class Image # @param opts [Hash] Set of options # @return [Vips::Image] Output image +# @!method self.sum(im, **opts) +# Sum an array of images. +# @param im [Array] Array of input images +# @param opts [Hash] Set of options +# @return [Vips::Image] Output image + # @!method avg(**opts) # Find image average. # @param opts [Hash] Set of options @@ -253,6 +272,7 @@ class Image # @param x [Integer] Point to read # @param y [Integer] Point to read # @param opts [Hash] Set of options +# @option opts [Boolean] :unpack_complex Complex pixels should be unpacked # @return [Array] Array of output values # @!method find_trim(**opts) @@ -304,14 +324,6 @@ class Image # @option opts [Integer] :tile_height Tile height in pixels # @return [Vips::Image] Output image -# @!method cache(**opts) -# Cache an image. -# @param opts [Hash] Set of options -# @option opts [Integer] :max_tiles Maximum number of tiles to cache -# @option opts [Integer] :tile_height Tile height in pixels -# @option opts [Integer] :tile_width Tile width in pixels -# @return [Vips::Image] Output image - # @!method embed(x, y, width, height, **opts) # Embed an image in a larger image. # @param x [Integer] Left edge of input in output @@ -573,6 +585,11 @@ class Image # @option opts [Boolean] :premultiplied Images have premultiplied alpha # @return [Vips::Image] Output image +# @!method addalpha(**opts) +# Append an alpha channel. +# @param opts [Hash] Set of options +# @return [Vips::Image] Output image + # @!method self.black(width, height, **opts) # Make a black image. # @param width [Integer] Image width in pixels @@ -636,6 +653,18 @@ class Image # @option opts [Integer] :autofit_dpi Output DPI selected by autofit # @return [Vips::Image, Hash Object>] Output image, Hash of optional output items +# @!method self.sdf(width, height, shape, **opts) +# Create an sdf image. +# @param width [Integer] Image width in pixels +# @param height [Integer] Image height in pixels +# @param shape [Vips::SdfShape] SDF shape to create +# @param opts [Hash] Set of options +# @option opts [Float] :r Radius +# @option opts [Array] :a Point a +# @option opts [Array] :b Point b +# @option opts [Array] :corners Corner radii +# @return [Vips::Image] Output image + # @!method self.eye(width, height, **opts) # Make an image showing the eye's spatial response. # @param width [Integer] Image width in pixels @@ -1462,6 +1491,8 @@ class Image # Load jpeg-xl image. # @param filename [String] Filename to load from # @param opts [Hash] Set of options +# @option opts [Integer] :page First page to load +# @option opts [Integer] :n Number of pages to load, -1 for all # @option opts [Boolean] :memory Force open via memory # @option opts [Vips::Access] :access Required access pattern for this file # @option opts [Vips::FailOn] :fail_on Error level to fail on @@ -1473,6 +1504,8 @@ class Image # Load jpeg-xl image. # @param buffer [VipsBlob] Buffer to load from # @param opts [Hash] Set of options +# @option opts [Integer] :page First page to load +# @option opts [Integer] :n Number of pages to load, -1 for all # @option opts [Boolean] :memory Force open via memory # @option opts [Vips::Access] :access Required access pattern for this file # @option opts [Vips::FailOn] :fail_on Error level to fail on @@ -1484,6 +1517,8 @@ class Image # Load jpeg-xl image. # @param source [Vips::Source] Source to load from # @param opts [Hash] Set of options +# @option opts [Integer] :page First page to load +# @option opts [Integer] :n Number of pages to load, -1 for all # @option opts [Boolean] :memory Force open via memory # @option opts [Vips::Access] :access Required access pattern for this file # @option opts [Vips::FailOn] :fail_on Error level to fail on @@ -1574,91 +1609,100 @@ class Image # Save image to csv. # @param filename [String] Filename to save to # @param opts [Hash] Set of options -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [String] :separator Separator characters # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method csvsave_target(target, **opts) # Save image to csv. # @param target [Vips::Target] Target to save to # @param opts [Hash] Set of options -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [String] :separator Separator characters # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method matrixsave(filename, **opts) # Save image to matrix. # @param filename [String] Filename to save to # @param opts [Hash] Set of options -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method matrixsave_target(target, **opts) # Save image to matrix. # @param target [Vips::Target] Target to save to # @param opts [Hash] Set of options -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method matrixprint(**opts) # Print matrix. # @param opts [Hash] Set of options -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method rawsave(filename, **opts) # Save image to raw file. # @param filename [String] Filename to save to # @param opts [Hash] Set of options -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] -# @!method rawsave_fd(fd, **opts) -# Write raw image to file descriptor. -# @param fd [Integer] File descriptor to write to +# @!method rawsave_buffer(**opts) +# Write raw image to buffer. # @param opts [Hash] Set of options +# @option opts [Vips::ForeignKeep] :keep Which metadata to retain +# @option opts [Array] :background Background value +# @option opts [Integer] :page_height Set page height for multipage save # @option opts [String] :profile Filename of ICC profile to embed +# @return [VipsBlob] Buffer to save to + +# @!method rawsave_target(target, **opts) +# Write raw image to target. +# @param target [Vips::Target] Target to save to +# @param opts [Hash] Set of options # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method vipssave(filename, **opts) # Save image to file in vips format. # @param filename [String] Filename to save to # @param opts [Hash] Set of options -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method vipssave_target(target, **opts) # Save image to target in vips format. # @param target [Vips::Target] Target to save to # @param opts [Hash] Set of options -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method ppmsave(filename, **opts) @@ -1667,11 +1711,11 @@ class Image # @param opts [Hash] Set of options # @option opts [Vips::ForeignPpmFormat] :format Format to save in # @option opts [Boolean] :ascii Save as ascii -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Integer] :bitdepth Set to 1 to write as a 1 bit image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method ppmsave_target(target, **opts) @@ -1680,48 +1724,47 @@ class Image # @param opts [Hash] Set of options # @option opts [Vips::ForeignPpmFormat] :format Format to save in # @option opts [Boolean] :ascii Save as ascii -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Integer] :bitdepth Set to 1 to write as a 1 bit image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method radsave(filename, **opts) # Save image to radiance file. # @param filename [String] Filename to save to # @param opts [Hash] Set of options -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method radsave_buffer(**opts) # Save image to radiance buffer. # @param opts [Hash] Set of options -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [VipsBlob] Buffer to save to # @!method radsave_target(target, **opts) # Save image to radiance target. # @param target [Vips::Target] Target to save to # @param opts [Hash] Set of options -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method jp2ksave(filename, **opts) # Save image in jpeg2000 format. -# @param filename [String] Filename to load from +# @param filename [String] Filename to save to # @param opts [Hash] Set of options # @option opts [Integer] :tile_width Tile width in pixels -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Integer] :tile_height Tile height in pixels # @option opts [Boolean] :lossless Enable lossless compression # @option opts [Integer] :Q Q factor @@ -1729,13 +1772,13 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method jp2ksave_buffer(**opts) # Save image in jpeg2000 format. # @param opts [Hash] Set of options # @option opts [Integer] :tile_width Tile width in pixels -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Integer] :tile_height Tile height in pixels # @option opts [Boolean] :lossless Enable lossless compression # @option opts [Integer] :Q Q factor @@ -1743,6 +1786,7 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [VipsBlob] Buffer to save to # @!method jp2ksave_target(target, **opts) @@ -1750,7 +1794,6 @@ class Image # @param target [Vips::Target] Target to save to # @param opts [Hash] Set of options # @option opts [Integer] :tile_width Tile width in pixels -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Integer] :tile_height Tile height in pixels # @option opts [Boolean] :lossless Enable lossless compression # @option opts [Integer] :Q Q factor @@ -1758,6 +1801,7 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method gifsave(filename, **opts) @@ -1766,7 +1810,6 @@ class Image # @param opts [Hash] Set of options # @option opts [Float] :dither Amount of dithering # @option opts [Integer] :effort Quantisation effort -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Integer] :bitdepth Number of bits per pixel # @option opts [Float] :interframe_maxerror Maximum inter-frame error for transparency # @option opts [Boolean] :reuse Reuse palette from input @@ -1775,6 +1818,7 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method gifsave_buffer(**opts) @@ -1782,7 +1826,6 @@ class Image # @param opts [Hash] Set of options # @option opts [Float] :dither Amount of dithering # @option opts [Integer] :effort Quantisation effort -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Integer] :bitdepth Number of bits per pixel # @option opts [Float] :interframe_maxerror Maximum inter-frame error for transparency # @option opts [Boolean] :reuse Reuse palette from input @@ -1791,6 +1834,7 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [VipsBlob] Buffer to save to # @!method gifsave_target(target, **opts) @@ -1799,7 +1843,6 @@ class Image # @param opts [Hash] Set of options # @option opts [Float] :dither Amount of dithering # @option opts [Integer] :effort Quantisation effort -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Integer] :bitdepth Number of bits per pixel # @option opts [Float] :interframe_maxerror Maximum inter-frame error for transparency # @option opts [Boolean] :reuse Reuse palette from input @@ -1808,6 +1851,7 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method dzsave(filename, **opts) @@ -1819,7 +1863,6 @@ class Image # @option opts [String] :suffix Filename suffix for tiles # @option opts [Integer] :overlap Tile overlap in pixels # @option opts [Integer] :tile_size Tile size in pixels -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Boolean] :centre Center image in tile # @option opts [Vips::ForeignDzDepth] :depth Pyramid depth # @option opts [Vips::Angle] :angle Rotate image during save @@ -1832,6 +1875,7 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method dzsave_buffer(**opts) @@ -1842,7 +1886,6 @@ class Image # @option opts [String] :suffix Filename suffix for tiles # @option opts [Integer] :overlap Tile overlap in pixels # @option opts [Integer] :tile_size Tile size in pixels -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Boolean] :centre Center image in tile # @option opts [Vips::ForeignDzDepth] :depth Pyramid depth # @option opts [Vips::Angle] :angle Rotate image during save @@ -1855,6 +1898,7 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [VipsBlob] Buffer to save to # @!method dzsave_target(target, **opts) @@ -1866,7 +1910,6 @@ class Image # @option opts [String] :suffix Filename suffix for tiles # @option opts [Integer] :overlap Tile overlap in pixels # @option opts [Integer] :tile_size Tile size in pixels -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Boolean] :centre Center image in tile # @option opts [Vips::ForeignDzDepth] :depth Pyramid depth # @option opts [Vips::Angle] :angle Rotate image during save @@ -1879,16 +1922,16 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method pngsave(filename, **opts) -# Save image to png file. +# Save image to file as png. # @param filename [String] Filename to save to # @param opts [Hash] Set of options # @option opts [Integer] :compression Compression factor # @option opts [Boolean] :interlace Interlace image -# @option opts [String] :profile Filename of ICC profile to embed -# @option opts [Vips::ForeignPngFilter] :filter libpng row filter flag(s) +# @option opts [Vips::ForeignPngFilter] :filter libspng row filter flag(s) # @option opts [Boolean] :palette Quantise to 8bpp palette # @option opts [Integer] :Q Quantisation quality # @option opts [Float] :dither Amount of dithering @@ -1897,15 +1940,15 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method pngsave_buffer(**opts) -# Save image to png buffer. +# Save image to buffer as png. # @param opts [Hash] Set of options # @option opts [Integer] :compression Compression factor # @option opts [Boolean] :interlace Interlace image -# @option opts [String] :profile Filename of ICC profile to embed -# @option opts [Vips::ForeignPngFilter] :filter libpng row filter flag(s) +# @option opts [Vips::ForeignPngFilter] :filter libspng row filter flag(s) # @option opts [Boolean] :palette Quantise to 8bpp palette # @option opts [Integer] :Q Quantisation quality # @option opts [Float] :dither Amount of dithering @@ -1914,6 +1957,7 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [VipsBlob] Buffer to save to # @!method pngsave_target(target, **opts) @@ -1922,8 +1966,7 @@ class Image # @param opts [Hash] Set of options # @option opts [Integer] :compression Compression factor # @option opts [Boolean] :interlace Interlace image -# @option opts [String] :profile Filename of ICC profile to embed -# @option opts [Vips::ForeignPngFilter] :filter libpng row filter flag(s) +# @option opts [Vips::ForeignPngFilter] :filter libspng row filter flag(s) # @option opts [Boolean] :palette Quantise to 8bpp palette # @option opts [Integer] :Q Quantisation quality # @option opts [Float] :dither Amount of dithering @@ -1932,6 +1975,7 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method jpegsave(filename, **opts) @@ -1939,7 +1983,6 @@ class Image # @param filename [String] Filename to save to # @param opts [Hash] Set of options # @option opts [Integer] :Q Q factor -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Boolean] :optimize_coding Compute optimal Huffman coding tables # @option opts [Boolean] :interlace Generate an interlaced (progressive) jpeg # @option opts [Boolean] :trellis_quant Apply trellis quantisation to each 8x8 block @@ -1951,13 +1994,13 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method jpegsave_buffer(**opts) # Save image to jpeg buffer. # @param opts [Hash] Set of options # @option opts [Integer] :Q Q factor -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Boolean] :optimize_coding Compute optimal Huffman coding tables # @option opts [Boolean] :interlace Generate an interlaced (progressive) jpeg # @option opts [Boolean] :trellis_quant Apply trellis quantisation to each 8x8 block @@ -1969,6 +2012,7 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [VipsBlob] Buffer to save to # @!method jpegsave_target(target, **opts) @@ -1976,7 +2020,6 @@ class Image # @param target [Vips::Target] Target to save to # @param opts [Hash] Set of options # @option opts [Integer] :Q Q factor -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Boolean] :optimize_coding Compute optimal Huffman coding tables # @option opts [Boolean] :interlace Generate an interlaced (progressive) jpeg # @option opts [Boolean] :trellis_quant Apply trellis quantisation to each 8x8 block @@ -1988,13 +2031,13 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method jpegsave_mime(**opts) # Save image to jpeg mime. # @param opts [Hash] Set of options # @option opts [Integer] :Q Q factor -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Boolean] :optimize_coding Compute optimal Huffman coding tables # @option opts [Boolean] :interlace Generate an interlaced (progressive) jpeg # @option opts [Boolean] :trellis_quant Apply trellis quantisation to each 8x8 block @@ -2006,6 +2049,7 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method webpsave(filename, **opts) @@ -2014,7 +2058,6 @@ class Image # @param opts [Hash] Set of options # @option opts [Integer] :Q Q factor # @option opts [Boolean] :lossless Enable lossless compression -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignWebpPreset] :preset Preset for lossy compression # @option opts [Boolean] :smart_subsample Enable high quality chroma subsampling # @option opts [Boolean] :near_lossless Enable preprocessing in lossless mode (uses Q) @@ -2023,10 +2066,14 @@ class Image # @option opts [Integer] :kmin Minimum number of frames between key frames # @option opts [Integer] :kmax Maximum number of frames between key frames # @option opts [Integer] :effort Level of CPU effort to reduce file size +# @option opts [Integer] :target_size Desired target size in bytes # @option opts [Boolean] :mixed Allow mixed encoding (might reduce file size) +# @option opts [Boolean] :smart_deblock Enable auto-adjusting of the deblocking filter +# @option opts [Integer] :passes Number of entropy-analysis passes (in [1..10]) # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method webpsave_buffer(**opts) @@ -2034,7 +2081,6 @@ class Image # @param opts [Hash] Set of options # @option opts [Integer] :Q Q factor # @option opts [Boolean] :lossless Enable lossless compression -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignWebpPreset] :preset Preset for lossy compression # @option opts [Boolean] :smart_subsample Enable high quality chroma subsampling # @option opts [Boolean] :near_lossless Enable preprocessing in lossless mode (uses Q) @@ -2043,10 +2089,14 @@ class Image # @option opts [Integer] :kmin Minimum number of frames between key frames # @option opts [Integer] :kmax Maximum number of frames between key frames # @option opts [Integer] :effort Level of CPU effort to reduce file size +# @option opts [Integer] :target_size Desired target size in bytes # @option opts [Boolean] :mixed Allow mixed encoding (might reduce file size) +# @option opts [Boolean] :smart_deblock Enable auto-adjusting of the deblocking filter +# @option opts [Integer] :passes Number of entropy-analysis passes (in [1..10]) # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [VipsBlob] Buffer to save to # @!method webpsave_target(target, **opts) @@ -2055,7 +2105,6 @@ class Image # @param opts [Hash] Set of options # @option opts [Integer] :Q Q factor # @option opts [Boolean] :lossless Enable lossless compression -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignWebpPreset] :preset Preset for lossy compression # @option opts [Boolean] :smart_subsample Enable high quality chroma subsampling # @option opts [Boolean] :near_lossless Enable preprocessing in lossless mode (uses Q) @@ -2064,10 +2113,14 @@ class Image # @option opts [Integer] :kmin Minimum number of frames between key frames # @option opts [Integer] :kmax Maximum number of frames between key frames # @option opts [Integer] :effort Level of CPU effort to reduce file size +# @option opts [Integer] :target_size Desired target size in bytes # @option opts [Boolean] :mixed Allow mixed encoding (might reduce file size) +# @option opts [Boolean] :smart_deblock Enable auto-adjusting of the deblocking filter +# @option opts [Integer] :passes Number of entropy-analysis passes (in [1..10]) # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method webpsave_mime(**opts) @@ -2075,7 +2128,6 @@ class Image # @param opts [Hash] Set of options # @option opts [Integer] :Q Q factor # @option opts [Boolean] :lossless Enable lossless compression -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignWebpPreset] :preset Preset for lossy compression # @option opts [Boolean] :smart_subsample Enable high quality chroma subsampling # @option opts [Boolean] :near_lossless Enable preprocessing in lossless mode (uses Q) @@ -2084,10 +2136,14 @@ class Image # @option opts [Integer] :kmin Minimum number of frames between key frames # @option opts [Integer] :kmax Maximum number of frames between key frames # @option opts [Integer] :effort Level of CPU effort to reduce file size +# @option opts [Integer] :target_size Desired target size in bytes # @option opts [Boolean] :mixed Allow mixed encoding (might reduce file size) +# @option opts [Boolean] :smart_deblock Enable auto-adjusting of the deblocking filter +# @option opts [Integer] :passes Number of entropy-analysis passes (in [1..10]) # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method tiffsave(filename, **opts) @@ -2099,7 +2155,6 @@ class Image # @option opts [Vips::ForeignTiffPredictor] :predictor Compression prediction # @option opts [Boolean] :tile Write a tiled tiff # @option opts [Integer] :tile_width Tile width in pixels -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Integer] :tile_height Tile height in pixels # @option opts [Boolean] :pyramid Write a pyramidal tiff # @option opts [Boolean] :miniswhite Use 0 for white in 1-bit images @@ -2110,7 +2165,7 @@ class Image # @option opts [Boolean] :bigtiff Write a bigtiff image # @option opts [Boolean] :properties Write a properties document to IMAGEDESCRIPTION # @option opts [Vips::RegionShrink] :region_shrink Method to shrink regions -# @option opts [Integer] :level ZSTD compression level +# @option opts [Integer] :level Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level # @option opts [Boolean] :lossless Enable WEBP lossless mode # @option opts [Vips::ForeignDzDepth] :depth Pyramid depth # @option opts [Boolean] :subifd Save pyr layers as sub-IFDs @@ -2118,6 +2173,7 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method tiffsave_buffer(**opts) @@ -2128,7 +2184,6 @@ class Image # @option opts [Vips::ForeignTiffPredictor] :predictor Compression prediction # @option opts [Boolean] :tile Write a tiled tiff # @option opts [Integer] :tile_width Tile width in pixels -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Integer] :tile_height Tile height in pixels # @option opts [Boolean] :pyramid Write a pyramidal tiff # @option opts [Boolean] :miniswhite Use 0 for white in 1-bit images @@ -2139,7 +2194,7 @@ class Image # @option opts [Boolean] :bigtiff Write a bigtiff image # @option opts [Boolean] :properties Write a properties document to IMAGEDESCRIPTION # @option opts [Vips::RegionShrink] :region_shrink Method to shrink regions -# @option opts [Integer] :level ZSTD compression level +# @option opts [Integer] :level Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level # @option opts [Boolean] :lossless Enable WEBP lossless mode # @option opts [Vips::ForeignDzDepth] :depth Pyramid depth # @option opts [Boolean] :subifd Save pyr layers as sub-IFDs @@ -2147,6 +2202,7 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [VipsBlob] Buffer to save to # @!method tiffsave_target(target, **opts) @@ -2158,7 +2214,6 @@ class Image # @option opts [Vips::ForeignTiffPredictor] :predictor Compression prediction # @option opts [Boolean] :tile Write a tiled tiff # @option opts [Integer] :tile_width Tile width in pixels -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Integer] :tile_height Tile height in pixels # @option opts [Boolean] :pyramid Write a pyramidal tiff # @option opts [Boolean] :miniswhite Use 0 for white in 1-bit images @@ -2169,7 +2224,7 @@ class Image # @option opts [Boolean] :bigtiff Write a bigtiff image # @option opts [Boolean] :properties Write a properties document to IMAGEDESCRIPTION # @option opts [Vips::RegionShrink] :region_shrink Method to shrink regions -# @option opts [Integer] :level ZSTD compression level +# @option opts [Integer] :level Deflate (1-9, default 6) or ZSTD (1-22, default 9) compression level # @option opts [Boolean] :lossless Enable WEBP lossless mode # @option opts [Vips::ForeignDzDepth] :depth Pyramid depth # @option opts [Boolean] :subifd Save pyr layers as sub-IFDs @@ -2177,26 +2232,27 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method fitssave(filename, **opts) # Save image to fits file. # @param filename [String] Filename to save to # @param opts [Hash] Set of options -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method niftisave(filename, **opts) # Save image to nifti file. # @param filename [String] Filename to save to # @param opts [Hash] Set of options -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method heifsave(filename, **opts) @@ -2205,7 +2261,6 @@ class Image # @param opts [Hash] Set of options # @option opts [Integer] :Q Q factor # @option opts [Integer] :bitdepth Number of bits per pixel -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Boolean] :lossless Enable lossless compression # @option opts [Vips::ForeignHeifCompression] :compression Compression format # @option opts [Integer] :effort CPU effort @@ -2214,6 +2269,7 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method heifsave_buffer(**opts) @@ -2221,7 +2277,6 @@ class Image # @param opts [Hash] Set of options # @option opts [Integer] :Q Q factor # @option opts [Integer] :bitdepth Number of bits per pixel -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Boolean] :lossless Enable lossless compression # @option opts [Vips::ForeignHeifCompression] :compression Compression format # @option opts [Integer] :effort CPU effort @@ -2230,6 +2285,7 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [VipsBlob] Buffer to save to # @!method heifsave_target(target, **opts) @@ -2238,7 +2294,6 @@ class Image # @param opts [Hash] Set of options # @option opts [Integer] :Q Q factor # @option opts [Integer] :bitdepth Number of bits per pixel -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Boolean] :lossless Enable lossless compression # @option opts [Vips::ForeignHeifCompression] :compression Compression format # @option opts [Integer] :effort CPU effort @@ -2247,21 +2302,22 @@ class Image # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method jxlsave(filename, **opts) # Save image in jpeg-xl format. -# @param filename [String] Filename to load from +# @param filename [String] Filename to save to # @param opts [Hash] Set of options # @option opts [Integer] :tier Decode speed tier # @option opts [Float] :distance Target butteraugli distance -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Integer] :effort Encoding effort # @option opts [Boolean] :lossless Enable lossless compression # @option opts [Integer] :Q Quality factor # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method jxlsave_buffer(**opts) @@ -2269,13 +2325,13 @@ class Image # @param opts [Hash] Set of options # @option opts [Integer] :tier Decode speed tier # @option opts [Float] :distance Target butteraugli distance -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Integer] :effort Encoding effort # @option opts [Boolean] :lossless Enable lossless compression # @option opts [Integer] :Q Quality factor # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [VipsBlob] Buffer to save to # @!method jxlsave_target(target, **opts) @@ -2284,13 +2340,13 @@ class Image # @param opts [Hash] Set of options # @option opts [Integer] :tier Decode speed tier # @option opts [Float] :distance Target butteraugli distance -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Integer] :effort Encoding effort # @option opts [Boolean] :lossless Enable lossless compression # @option opts [Integer] :Q Quality factor # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method magicksave(filename, **opts) @@ -2302,10 +2358,10 @@ class Image # @option opts [Boolean] :optimize_gif_frames Apply GIF frames optimization # @option opts [Boolean] :optimize_gif_transparency Apply GIF transparency optimization # @option opts [Integer] :bitdepth Number of bits per pixel -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [nil] # @!method magicksave_buffer(**opts) @@ -2316,10 +2372,10 @@ class Image # @option opts [Boolean] :optimize_gif_frames Apply GIF frames optimization # @option opts [Boolean] :optimize_gif_transparency Apply GIF transparency optimization # @option opts [Integer] :bitdepth Number of bits per pixel -# @option opts [String] :profile Filename of ICC profile to embed # @option opts [Vips::ForeignKeep] :keep Which metadata to retain # @option opts [Array] :background Background value # @option opts [Integer] :page_height Set page height for multipage save +# @option opts [String] :profile Filename of ICC profile to embed # @return [VipsBlob] Buffer to save to # @!method self.thumbnail(filename, width, **opts) @@ -2470,7 +2526,7 @@ class Image # Similarity transform of an image. # @param opts [Hash] Set of options # @option opts [Float] :scale Scale by this factor -# @option opts [Float] :angle Rotate anticlockwise by this many degrees +# @option opts [Float] :angle Rotate clockwise by this many degrees # @option opts [Vips::Interpolate] :interpolate Interpolate pixels with this # @option opts [Array] :background Background value # @option opts [Float] :odx Horizontal output displacement @@ -2481,7 +2537,7 @@ class Image # @!method rotate(angle, **opts) # Rotate an image by a number of degrees. -# @param angle [Float] Rotate anticlockwise by this many degrees +# @param angle [Float] Rotate clockwise by this many degrees # @param opts [Hash] Set of options # @option opts [Vips::Interpolate] :interpolate Interpolate pixels with this # @option opts [Array] :background Background value diff --git a/lib/vips/operation.rb b/lib/vips/operation.rb index aebe598..7d58bc1 100644 --- a/lib/vips/operation.rb +++ b/lib/vips/operation.rb @@ -218,7 +218,7 @@ def initialize value raise Vips::Error if value.null? end - super(value) + super end def build diff --git a/lib/vips/version.rb b/lib/vips/version.rb index c60474f..7e19f84 100644 --- a/lib/vips/version.rb +++ b/lib/vips/version.rb @@ -1,3 +1,3 @@ module Vips - VERSION = "2.2.1" + VERSION = "2.2.3" end diff --git a/ruby-vips.gemspec b/ruby-vips.gemspec index 9e70604..6f0ec85 100644 --- a/ruby-vips.gemspec +++ b/ruby-vips.gemspec @@ -36,6 +36,7 @@ Gem::Specification.new do |spec| spec.required_ruby_version = ">= 2.0.0" spec.add_runtime_dependency "ffi", ["~> 1.12"] + spec.add_runtime_dependency "logger" spec.add_development_dependency "rake", ["~> 12.0"] spec.add_development_dependency "rspec", ["~> 3.3"]