From 491d7d9d176f6baaa656d6126b358daf5b27d124 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Thu, 7 Mar 2024 10:53:03 +0100 Subject: [PATCH 01/21] Fix compat with shared Windows builds --- lib/vips.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vips.rb b/lib/vips.rb index 45c103d..3d55024 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 From 2cb995d56ca9023a69d487dc83b499ea7759759a Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Thu, 7 Mar 2024 10:56:45 +0100 Subject: [PATCH 02/21] Fix lint --- lib/vips.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/vips.rb b/lib/vips.rb index 3d55024..92af2e2 100644 --- a/lib/vips.rb +++ b/lib/vips.rb @@ -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 From c1a05c26494c5e0115ca9752ade3ad6afdcc7cf3 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 5 Jun 2024 14:02:15 +0100 Subject: [PATCH 03/21] add logger to the gemspec Since logger will be unbundled in ruby 3.5. Thanks Earlopain See https://github.com/libvips/ruby-vips/issues/397 --- ruby-vips.gemspec | 1 + 1 file changed, 1 insertion(+) 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"] From 12159bd8990a3e0de619b76068dfa71a58ad0f18 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 5 Jun 2024 14:10:14 +0100 Subject: [PATCH 04/21] remove ruby 2.1 from testing since it doesn't support logger --- .github/workflows/test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5492d03..54eb625 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,6 @@ jobs: matrix: os-version: [ 'ubuntu-20.04' ] ruby-version: - - '2.1' - '2.2' - '2.3' - '2.4' @@ -75,7 +74,7 @@ jobs: DEBIAN_FRONTEND: noninteractive run: # we only need the library - sudo apt-get install --fix-missing -qq -o Acquire::Retries=3 + sudo apt-get install --no-install-recommends --fix-missing -qq -o Acquire::Retries=3 libvips - name: Run Tests From ebcb853f3f244b4bc1294b9700656acf8b90962f Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 5 Jun 2024 14:12:17 +0100 Subject: [PATCH 05/21] remove ruby 2.2 from CI since it does not support logger --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 54eb625..ed7f306 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,6 @@ jobs: matrix: os-version: [ 'ubuntu-20.04' ] ruby-version: - - '2.2' - '2.3' - '2.4' - '2.5' From 7a2b9ba3819178ae744661be461b7546cb636d40 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 17 Jul 2024 12:14:04 +0100 Subject: [PATCH 06/21] version bump to 2.2.2 --- CHANGELOG.md | 2 ++ VERSION | 2 +- lib/vips/version.rb | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38a12a4..caabbb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## master +## 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..b1b25a5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.1 +2.2.2 diff --git a/lib/vips/version.rb b/lib/vips/version.rb index c60474f..44e9f33 100644 --- a/lib/vips/version.rb +++ b/lib/vips/version.rb @@ -1,3 +1,3 @@ module Vips - VERSION = "2.2.1" + VERSION = "2.2.2" end From 61d8d931a2d23db85cd3382125f75b3f1e5ed77e Mon Sep 17 00:00:00 2001 From: Rodrigo Argumedo <7613139+rodrigoargumedo@users.noreply.github.com> Date: Fri, 2 Aug 2024 13:56:59 +0000 Subject: [PATCH 07/21] Lint code --- lib/vips/operation.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 90a7fe3bdaa1824c168addf74f4ef7bba621eac4 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Fri, 2 Aug 2024 16:48:36 +0200 Subject: [PATCH 08/21] CI: remove `pull_request_target` event --- .github/workflows/test.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed7f306..617e861 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 From 8d87f5c77f7a98cb193376ea58652a1201755500 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Fri, 2 Aug 2024 16:49:05 +0200 Subject: [PATCH 09/21] CI: upgrade runner to Ubuntu 24.04 --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 617e861..51c7958 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,7 +29,7 @@ jobs: strategy: matrix: - os-version: [ 'ubuntu-20.04' ] + os-version: [ 'ubuntu-24.04' ] ruby-version: - '2.3' - '2.4' From 5c01af149645977704fdb2a9e8f7e950102f92bc Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Fri, 2 Aug 2024 16:50:17 +0200 Subject: [PATCH 10/21] CI: consolidate and simplify APT steps --- .github/workflows/test.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 51c7958..a40b6fa 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -55,19 +55,13 @@ 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 --no-install-recommends --fix-missing -qq -o Acquire::Retries=3 - libvips + sudo apt-get install --no-install-recommends libvips - name: Run Tests run: bundle exec rake spec From 41f6e45c11ce37010a25255f4bb8d66e0c7de7aa Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Fri, 2 Aug 2024 16:53:24 +0200 Subject: [PATCH 11/21] CI: remove redundant `DEBIAN_FRONTEND=noninteractive` env The Linux runners on GitHub Actions already sets this env variable, see: https://github.com/actions/runner-images/blob/2a4bc14da46f1f8e358aa902a69edb9bef135472/images/ubuntu/scripts/build/configure-dpkg.sh#L17 --- .github/workflows/test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a40b6fa..a7216f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,8 +56,6 @@ jobs: bundler-cache: true - name: Install libvips - env: - DEBIAN_FRONTEND: noninteractive run: | sudo apt-get update # we only need the library From 66f2d1720927a9ec9ce8729c6cc6187f3cbedd3b Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sat, 12 Oct 2024 14:32:37 +0100 Subject: [PATCH 12/21] update docs for 8.16 --- lib/vips/methods.rb | 200 +++++++++++++++++++++++++++--------------- lib/vips/operation.rb | 2 +- 2 files changed, 129 insertions(+), 73 deletions(-) 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 From bafd88c211063131f27ce5c51a37d13bac5299f7 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Mon, 4 Nov 2024 10:04:35 +0100 Subject: [PATCH 13/21] Ensure variadic call is null-terminated --- CHANGELOG.md | 2 ++ lib/vips/image.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index caabbb5..9bb5fd7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## master +* fix `Image#add_alpha()` with libvips 8.16 [kleisauke] + ## Version 2.2.2 (2024-07-17) * fix compat with unified (semistatic) libvips binaries [kleisauke] diff --git a/lib/vips/image.rb b/lib/vips/image.rb index 45bd2ed..e777d47 100644 --- a/lib/vips/image.rb +++ b/lib/vips/image.rb @@ -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] From ff74ca67b9de320d0ee36a94f8fe974cd6ef0a1b Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Thu, 6 Feb 2025 10:37:01 +0100 Subject: [PATCH 14/21] Ensure correct FFI function definitions for `gboolean` parameters `gboolean` is a typedef for `int` in GLib. Resolves: #410. --- CHANGELOG.md | 1 + lib/vips.rb | 12 ++++++------ lib/vips/image.rb | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bb5fd7..7c09392 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## master * fix `Image#add_alpha()` with libvips 8.16 [kleisauke] +* fix FFI function definitions for `gboolean` parameters [kleisauke] ## Version 2.2.2 (2024-07-17) diff --git a/lib/vips.rb b/lib/vips.rb index 92af2e2..aed3f1a 100644 --- a/lib/vips.rb +++ b/lib/vips.rb @@ -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 e777d47..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 From 9fb56ce86652c63d36f361991033f3787884dc8d Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 6 Feb 2025 07:30:41 -0800 Subject: [PATCH 15/21] bump version to 2.2.3 --- CHANGELOG.md | 2 ++ VERSION | 2 +- lib/vips/version.rb | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c09392..876f8fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 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] diff --git a/VERSION b/VERSION index b1b25a5..5859406 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.2 +2.2.3 diff --git a/lib/vips/version.rb b/lib/vips/version.rb index 44e9f33..7e19f84 100644 --- a/lib/vips/version.rb +++ b/lib/vips/version.rb @@ -1,3 +1,3 @@ module Vips - VERSION = "2.2.2" + VERSION = "2.2.3" end From 12140cead027b256a99b4fc56c4725b57df7de90 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 5 Jun 2025 16:18:43 +0100 Subject: [PATCH 16/21] update target test for 8.17 --- CHANGELOG.md | 4 ++++ spec/connection_spec.rb | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 876f8fa..fd64d0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## master +## Version 2.2.4 (2025-06-05) + +* fix write to target test with libvips 8.17 [jcupitt] + ## Version 2.2.3 (2025-02-06) * fix `Image#add_alpha()` with libvips 8.16 [kleisauke] diff --git a/spec/connection_spec.rb b/spec/connection_spec.rb index 10dc4c7..35f3c25 100644 --- a/spec/connection_spec.rb +++ b/spec/connection_spec.rb @@ -66,7 +66,9 @@ it "can't create a target to a bad filename" do expect { - Vips::Target.new_to_file "/banana/monkey" + target = Vips::Target.new_to_file "/banana/monkey" + image = Vips::Image.black 1, 1 + image.write_to_target(target, "") }.to raise_exception(Vips::Error) end From 80a222b9a06f93cccd6fb00607987b62adc10e5e Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 5 Jun 2025 16:19:25 +0100 Subject: [PATCH 17/21] version bump and docs update --- CHANGELOG.md | 1 + VERSION | 2 +- lib/vips/methods.rb | 123 +++++++++++++++++++++++++++++--------------- lib/vips/version.rb | 2 +- 4 files changed, 84 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd64d0a..1eb1e61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ## Version 2.2.4 (2025-06-05) * fix write to target test with libvips 8.17 [jcupitt] +* update docs for libvips 8.17 [jcupitt] ## Version 2.2.3 (2025-02-06) diff --git a/VERSION b/VERSION index 5859406..530cdd9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.3 +2.2.4 diff --git a/lib/vips/methods.rb b/lib/vips/methods.rb index a514d71..9f1fea1 100644 --- a/lib/vips/methods.rb +++ b/lib/vips/methods.rb @@ -1018,8 +1018,19 @@ class Image # @option opts [Vips::ForeignFlags] :flags Output Flags for this file # @return [Vips::Image, Hash Object>] Output image, Hash of optional output items +# @!method self.ppmload_buffer(buffer, **opts) +# Load ppm from buffer. +# @param buffer [VipsBlob] Buffer to load from +# @param opts [Hash] Set of options +# @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 +# @option opts [Boolean] :revalidate Don't use a cached result for this operation +# @option opts [Vips::ForeignFlags] :flags Output Flags for this file +# @return [Vips::Image, Hash Object>] Output image, Hash of optional output items + # @!method self.ppmload_source(source, **opts) -# Load ppm base class. +# Load ppm from source. # @param source [Vips::Source] Source to load from # @param opts [Hash] Set of options # @option opts [Boolean] :memory Force open via memory @@ -1069,6 +1080,8 @@ class Image # @option opts [Float] :dpi Render at this DPI # @option opts [Float] :scale Scale output by this factor # @option opts [Boolean] :unlimited Allow SVG of any size +# @option opts [String] :stylesheet Custom CSS +# @option opts [Boolean] :high_bitdepth Enable scRGB 128-bit output (32-bit per channel) # @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 @@ -1083,6 +1096,8 @@ class Image # @option opts [Float] :dpi Render at this DPI # @option opts [Float] :scale Scale output by this factor # @option opts [Boolean] :unlimited Allow SVG of any size +# @option opts [String] :stylesheet Custom CSS +# @option opts [Boolean] :high_bitdepth Enable scRGB 128-bit output (32-bit per channel) # @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 @@ -1097,6 +1112,8 @@ class Image # @option opts [Float] :dpi Render at this DPI # @option opts [Float] :scale Scale output by this factor # @option opts [Boolean] :unlimited Allow SVG of any size +# @option opts [String] :stylesheet Custom CSS +# @option opts [Boolean] :high_bitdepth Enable scRGB 128-bit output (32-bit per channel) # @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 @@ -1109,6 +1126,7 @@ class Image # @param filename [String] Filename to load from # @param opts [Hash] Set of options # @option opts [Integer] :page Load this page from the image +# @option opts [Boolean] :oneshot Load images a frame at a time # @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 @@ -1121,6 +1139,7 @@ class Image # @param buffer [VipsBlob] Buffer to load from # @param opts [Hash] Set of options # @option opts [Integer] :page Load this page from the image +# @option opts [Boolean] :oneshot Load images a frame at a time # @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 @@ -1133,6 +1152,7 @@ class Image # @param source [Vips::Source] Source to load from # @param opts [Hash] Set of options # @option opts [Integer] :page Load this page from the image +# @option opts [Boolean] :oneshot Load images a frame at a time # @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 @@ -1315,9 +1335,10 @@ class 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] :subifd Subifd index # @option opts [Integer] :n Number of pages to load, -1 for all # @option opts [Boolean] :autorotate Rotate image using orientation tag +# @option opts [Integer] :subifd Subifd index +# @option opts [Boolean] :unlimited Remove all denial of service limits # @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 @@ -1330,9 +1351,10 @@ class 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] :subifd Subifd index # @option opts [Integer] :n Number of pages to load, -1 for all # @option opts [Boolean] :autorotate Rotate image using orientation tag +# @option opts [Integer] :subifd Subifd index +# @option opts [Boolean] :unlimited Remove all denial of service limits # @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 @@ -1345,9 +1367,10 @@ class 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] :subifd Subifd index # @option opts [Integer] :n Number of pages to load, -1 for all # @option opts [Boolean] :autorotate Rotate image using orientation tag +# @option opts [Integer] :subifd Subifd index +# @option opts [Boolean] :unlimited Remove all denial of service limits # @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 @@ -1578,7 +1601,7 @@ class Image # @return [Vips::Image, Hash Object>] Output image, Hash of optional output items # @!method self.magickload(filename, **opts) -# Load file with imagemagick. +# Load file with imagemagick7. # @param filename [String] Filename to load from # @param opts [Hash] Set of options # @option opts [String] :density Canvas resolution for rendering vector formats like SVG @@ -1592,7 +1615,7 @@ class Image # @return [Vips::Image, Hash Object>] Output image, Hash of optional output items # @!method self.magickload_buffer(buffer, **opts) -# Load buffer with imagemagick. +# Load buffer with imagemagick7. # @param buffer [VipsBlob] Buffer to load from # @param opts [Hash] Set of options # @option opts [String] :density Canvas resolution for rendering vector formats like SVG @@ -1815,6 +1838,7 @@ class Image # @option opts [Boolean] :reuse Reuse palette from input # @option opts [Float] :interpalette_maxerror Maximum inter-palette error for palette reusage # @option opts [Boolean] :interlace Generate an interlaced (progressive) GIF +# @option opts [Boolean] :keep_duplicate_frames Keep duplicate frames in the output instead of combining them # @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 @@ -1831,6 +1855,7 @@ class Image # @option opts [Boolean] :reuse Reuse palette from input # @option opts [Float] :interpalette_maxerror Maximum inter-palette error for palette reusage # @option opts [Boolean] :interlace Generate an interlaced (progressive) GIF +# @option opts [Boolean] :keep_duplicate_frames Keep duplicate frames in the output instead of combining them # @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 @@ -1848,6 +1873,7 @@ class Image # @option opts [Boolean] :reuse Reuse palette from input # @option opts [Float] :interpalette_maxerror Maximum inter-palette error for palette reusage # @option opts [Boolean] :interlace Generate an interlaced (progressive) GIF +# @option opts [Boolean] :keep_duplicate_frames Keep duplicate frames in the output instead of combining them # @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 @@ -2388,8 +2414,8 @@ class Image # @option opts [Boolean] :no_rotate Don't use orientation tags to rotate image upright # @option opts [Vips::Interesting] :crop Reduce to fill target rectangle, then crop # @option opts [Boolean] :linear Reduce in linear light -# @option opts [String] :import_profile Fallback import profile -# @option opts [String] :export_profile Fallback export profile +# @option opts [String] :input_profile Fallback input profile +# @option opts [String] :output_profile Fallback output profile # @option opts [Vips::Intent] :intent Rendering intent # @option opts [Vips::FailOn] :fail_on Error level to fail on # @return [Vips::Image] Output image @@ -2405,8 +2431,8 @@ class Image # @option opts [Boolean] :no_rotate Don't use orientation tags to rotate image upright # @option opts [Vips::Interesting] :crop Reduce to fill target rectangle, then crop # @option opts [Boolean] :linear Reduce in linear light -# @option opts [String] :import_profile Fallback import profile -# @option opts [String] :export_profile Fallback export profile +# @option opts [String] :input_profile Fallback input profile +# @option opts [String] :output_profile Fallback output profile # @option opts [Vips::Intent] :intent Rendering intent # @option opts [Vips::FailOn] :fail_on Error level to fail on # @return [Vips::Image] Output image @@ -2420,8 +2446,8 @@ class Image # @option opts [Boolean] :no_rotate Don't use orientation tags to rotate image upright # @option opts [Vips::Interesting] :crop Reduce to fill target rectangle, then crop # @option opts [Boolean] :linear Reduce in linear light -# @option opts [String] :import_profile Fallback import profile -# @option opts [String] :export_profile Fallback export profile +# @option opts [String] :input_profile Fallback input profile +# @option opts [String] :output_profile Fallback output profile # @option opts [Vips::Intent] :intent Rendering intent # @option opts [Vips::FailOn] :fail_on Error level to fail on # @return [Vips::Image] Output image @@ -2437,8 +2463,8 @@ class Image # @option opts [Boolean] :no_rotate Don't use orientation tags to rotate image upright # @option opts [Vips::Interesting] :crop Reduce to fill target rectangle, then crop # @option opts [Boolean] :linear Reduce in linear light -# @option opts [String] :import_profile Fallback import profile -# @option opts [String] :export_profile Fallback export profile +# @option opts [String] :input_profile Fallback input profile +# @option opts [String] :output_profile Fallback output profile # @option opts [Vips::Intent] :intent Rendering intent # @option opts [Vips::FailOn] :fail_on Error level to fail on # @return [Vips::Image] Output image @@ -2605,6 +2631,16 @@ class Image # @param opts [Hash] Set of options # @return [Vips::Image] Output image +# @!method scRGB2XYZ(**opts) +# Transform scrgb to xyz. +# @param opts [Hash] Set of options +# @return [Vips::Image] Output image + +# @!method XYZ2scRGB(**opts) +# Transform xyz to scrgb. +# @param opts [Hash] Set of options +# @return [Vips::Image] Output image + # @!method LabQ2Lab(**opts) # Unpack a labq image to float lab. # @param opts [Hash] Set of options @@ -2650,6 +2686,17 @@ class Image # @param opts [Hash] Set of options # @return [Vips::Image] Output image +# @!method sRGB2scRGB(**opts) +# Convert an srgb image to scrgb. +# @param opts [Hash] Set of options +# @return [Vips::Image] Output image + +# @!method scRGB2BW(**opts) +# Convert scrgb to bw. +# @param opts [Hash] Set of options +# @option opts [Integer] :depth Output device space depth in bits +# @return [Vips::Image] Output image + # @!method sRGB2HSV(**opts) # Transform srgb to hsv. # @param opts [Hash] Set of options @@ -2660,6 +2707,12 @@ class Image # @param opts [Hash] Set of options # @return [Vips::Image] Output image +# @!method scRGB2sRGB(**opts) +# Convert scrgb to srgb. +# @param opts [Hash] Set of options +# @option opts [Integer] :depth Output device space depth in bits +# @return [Vips::Image] Output image + # @!method icc_import(**opts) # Import from device with icc profile. # @param opts [Hash] Set of options @@ -2710,33 +2763,6 @@ class Image # @param opts [Hash] Set of options # @return [Vips::Image] Output image -# @!method sRGB2scRGB(**opts) -# Convert an srgb image to scrgb. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method scRGB2XYZ(**opts) -# Transform scrgb to xyz. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method scRGB2BW(**opts) -# Convert scrgb to bw. -# @param opts [Hash] Set of options -# @option opts [Integer] :depth Output device space depth in bits -# @return [Vips::Image] Output image - -# @!method XYZ2scRGB(**opts) -# Transform xyz to scrgb. -# @param opts [Hash] Set of options -# @return [Vips::Image] Output image - -# @!method scRGB2sRGB(**opts) -# Convert an scrgb image to srgb. -# @param opts [Hash] Set of options -# @option opts [Integer] :depth Output device space depth in bits -# @return [Vips::Image] Output image - # @!method CMYK2XYZ(**opts) # Transform cmyk to xyz. # @param opts [Hash] Set of options @@ -3123,7 +3149,13 @@ class Image # @return [Vips::Image] Output image # @!method matrixinvert(**opts) -# Invert an matrix. +# Invert a matrix. +# @param opts [Hash] Set of options +# @return [Vips::Image] Output matrix + +# @!method matrixmultiply(right, **opts) +# Multiply two matrices. +# @param right [Vips::Image] Second matrix to multiply # @param opts [Hash] Set of options # @return [Vips::Image] Output matrix @@ -3150,6 +3182,13 @@ class Image # @param opts [Hash] Set of options # @option opts [Float] :gamma Image gamma # @option opts [Boolean] :int_output Integer output +# @return [Vips::Image] Output image + +# @!method remosaic(old_str, new_str, **opts) +# Rebuild an mosaiced image. +# @param old_str [String] Search for this string +# @param new_str [String] And swap for this string +# @param opts [Hash] Set of options # @return [Vips::Image] Output image end diff --git a/lib/vips/version.rb b/lib/vips/version.rb index 7e19f84..e00f5c8 100644 --- a/lib/vips/version.rb +++ b/lib/vips/version.rb @@ -1,3 +1,3 @@ module Vips - VERSION = "2.2.3" + VERSION = "2.2.4" end From 726357fff27635c5c27dfc5ea1682999c92120c8 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 17 Jul 2025 14:19:31 +0100 Subject: [PATCH 18/21] use `.null?` to test NULL pointer returns (#420) * use `.null?` to test NULL pointer returns we were using `.nil?` in a couple of cases see https://github.com/libvips/ruby-vips/issues/419 thanks dloebl * fix a rcop fail * add a null check to matrix_from_array for safety * and bump version --- CHANGELOG.md | 2 ++ VERSION | 2 +- lib/vips/image.rb | 8 ++++---- lib/vips/interpolate.rb | 2 +- lib/vips/version.rb | 2 +- spec/image_spec.rb | 5 +++++ spec/samples/coffee.gif | Bin 0 -> 2100 bytes spec/vips_spec.rb | 4 ++++ 8 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 spec/samples/coffee.gif diff --git a/CHANGELOG.md b/CHANGELOG.md index 1eb1e61..686cbe9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## master +* improve NULL pointer handling [dloebl] + ## Version 2.2.4 (2025-06-05) * fix write to target test with libvips 8.17 [jcupitt] diff --git a/VERSION b/VERSION index 530cdd9..21bb5e1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.4 +2.2.5 diff --git a/lib/vips/image.rb b/lib/vips/image.rb index ea8b1af..9ee303a 100644 --- a/lib/vips/image.rb +++ b/lib/vips/image.rb @@ -471,9 +471,10 @@ def self.new_from_source source, option_string, **opts 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, + img_ptr = Vips.vips_image_new_matrix_from_array width, height, ptr, array.length - Vips::Image.new image + raise Vips::Error if img_ptr.null? + Vips::Image.new img_ptr end # Create a new Image from a 1D or 2D array. A 1D array becomes an @@ -534,7 +535,6 @@ def self.new_from_array array, scale = 1, offset = 0 end image = Vips::Image.matrix_from_array width, height, array - raise Vips::Error if image.nil? image.mutate do |mutable| # be careful to set them as double @@ -700,7 +700,7 @@ def write_to_target target, format_string, **opts def write_to_memory len = Vips::SizeStruct.new ptr = Vips.vips_image_write_to_memory self, len - raise Vips::Error if ptr.nil? + raise Vips::Error if ptr.null? # wrap up as an autopointer ptr = FFI::AutoPointer.new(ptr, GLib::G_FREE) diff --git a/lib/vips/interpolate.rb b/lib/vips/interpolate.rb index e31450a..891b1e5 100644 --- a/lib/vips/interpolate.rb +++ b/lib/vips/interpolate.rb @@ -50,7 +50,7 @@ class ManagedStruct < Vips::Object::ManagedStruct def initialize name name = name.to_s if name.is_a? Symbol pointer = Vips.vips_interpolate_new name - raise Vips::Error if pointer.nil? + raise Vips::Error if pointer.null? super(pointer) end diff --git a/lib/vips/version.rb b/lib/vips/version.rb index e00f5c8..c7cc34f 100644 --- a/lib/vips/version.rb +++ b/lib/vips/version.rb @@ -1,3 +1,3 @@ module Vips - VERSION = "2.2.4" + VERSION = "2.2.5" end diff --git a/spec/image_spec.rb b/spec/image_spec.rb index 38fdb29..69ff2c3 100644 --- a/spec/image_spec.rb +++ b/spec/image_spec.rb @@ -76,6 +76,11 @@ expect(x.avg).to eq(128) end + it "will raise VipsError for invalid image files" do + img = Vips::Image.new_from_file simg("coffee.gif") + expect { img.write_to_memory }.to raise_exception(Vips::Error) + end + it "throws an error when trying to load an image from memory with unknown size" do data = FFI::Pointer.new(1) expect { Vips::Image.new_from_memory(data, 16, 16, 1, :uchar) }.to raise_error(Vips::Error) diff --git a/spec/samples/coffee.gif b/spec/samples/coffee.gif new file mode 100644 index 0000000000000000000000000000000000000000..bf794f617a8124d3a9daaa0e1a5c80580e385b78 GIT binary patch literal 2100 zcma)+c{mde1IM=+3iT6ONE&j4km2Dym$- zf16T!V6Ym115o}Q_+1MCbF644we6a#{jWKW3TRi)LXR4v&*~dLWqRPFnP4j^xLrU0chChypZ#->@?tAc81_9DIMTO>oL5tP0dV`s?uIH`qfds@HK|p{ym<;`+p6@(&5Ss#*G6JRCqG*vg$v z%aAjQ34|}Z&@x?aXQZ4LruN3i+V`f|1mH6Yr5{7`%hYA*c?w~CvY+u#<6JJDM037x z^2jQ91>Qb%79d`E(c(sdsqm6{y4`zU4Z(WvoJfZQT??~O!kq?BH}b!dxi^56^TWrh z5E|5JLMX8Hoe(VA1Oyg*Vd(WtZ4!tP{xLPQ`^1%i4YnmqXaty|QvQJI_`z$J26fDY zmnMRqWD{!^@DpiH%LqFd@VfW#$!P6~Su~oxw@vrTX1N`o4%uEB zDybtLUi%p|F=3sDP5s&YW0C&L681GbXng1GaM&9GO2kh3R)_pqPT)80BaDd2^X`sM zAZr>-LH;IzfX$}?S=n$8K<=v;i>g~lWu;m3!XKqI)?t;J-K*$Fq{$YYwtSRu$Own(%b zbh`Ks#B{L4=G;C$PA;-y=>aao#53J%O|}}Ddr!gX#Ra!r&+w8PqLS5lny%7iFB(^p zYNa~G?`M*pg)Uc@CK%}gsXY7yaMyl`w+k&nVXm%|$IQnTnB@2Ed|Ak)Rf5rwoY{I2 z2#)ZPWkPgTE9caNH(Flbzel_@M_ygm6>d@5Y}(R3SZjM18D{ln_bcKt&)A`o9u;)T zXRG6gJYlO-0JgT(C1_->5B^OSw;BKpP=*2o0Hy%v|3#L9IM@?G^!-hii@`r+)ys>C zr_tD!jWLWui?IOl0%pyaw>qNB-;G(Pq->eqSE;@~YSTK?XCY!4YMyYltxlUYF6;0w;3I$Fx?*vK)wBXh6Cw?*M~n*KkAH*1@ZAIF=l6P&9V977&8k@ zi!c?d$Hhjlb5f0|2wHP;+!%o#+)S5dl!WQrlE@B4pAm!MLvi-)gL+Cvfq!5wzHH(fKmL zhxV7%maP0tFv&K(uU2ddWs-bHl16Lp0&EPuf~=c9S$eyP6)?!Qb_g zHD;s!3R1E2a=69*AYz<21G}+2bfz{(l-1KKq>m;zHZJt#sCzR%Qb>#RVttgPMe7c0 z=zK{jv*EFZMW}9yDb^>|ZKT)e32UUipDZ-d=CA`$xk~n$uht(oI1CLmWEB;0mGp;b z`F<&XxyjrJJ?p=MZx7(T*b05RxYEP>7y|rfdeDEJD(1ugd8)=HP>hc+c3_ED@ugy} z?R-YwBi{xF3wK%t-QhL|OSLDZZZtntf(@^BX-Zbj9PCG4MT)patHuh)Cp-^E#iXLs z?#6kfr(`B&V^wTi6JID4coY?%bBB~yNLQY$u7MKn66+)z1jw&sLrD~COk4YzLYEH3 zF6uk+_jw=iWtjd}c*`f5Qrc*4RriEc@(5!nd2WEkp2}KUyh&eKJw^QdZhLUE`Qz5~ z_a9CB-_7_yd=i>l0=nFb07-ifj3XKO0HP)#^QWU)B0^EfM`1e~nFi(Ps{nNx%S|%f z^=fP=o)t8JybIQR*?*xlPw6e~>K=FHO<-7L%m^jm3#3G273#20(&Yky^Hn0cUe%aY zT2)9}kVL#b)j5(b35w&Dfb|}3$+A-w_`3kh;odv^*+_b$%1lo|AI{a`wdQu~wJF?1 zTWavsd^iHW;Y7BJJ7i3W5{LV&UbY%YQ&bjuaDU2-31p}bzjY2?iAcVzzFcltLq7EJ z5Aq(bd(<<~k05b>)(ho#-w)ft%+aE}29KSi1h7PNctZ}S^^K)R3J@0~u3q`Nezqa( z>~TqtAKUGHC?h)Jm+yC5UHhm%igusxt*+i&hhA%mJdpSXV}wK<81kNp0LwirM()Yd zhQQo%b5K741CPnLa>E3tgyct65~n5gc${M-(~VJ)9mQ~gP!TGmP)b?PV;Tj!BQFz+ zwi=(0PVdf1NgF-VoQ65D@wk6SXs~4fWh`#T=GN4vK!b1FdM;$cA6745?Vm0$;2aY| Jbisfte*>0#6fFP% literal 0 HcmV?d00001 diff --git a/spec/vips_spec.rb b/spec/vips_spec.rb index c569071..3b8c407 100644 --- a/spec/vips_spec.rb +++ b/spec/vips_spec.rb @@ -193,5 +193,9 @@ expect { black.crop(10, 10, 1, 1) }.to raise_exception(Vips::Error) end + + it "can throw errors for bad interpolations" do + expect { Vips::Interpolate.new "banana" }.to raise_exception(Vips::Error) + end end end From baa3123c6cb91dc468855a46c56b009bc3207e32 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 24 Jul 2025 15:58:39 +0100 Subject: [PATCH 19/21] improve gflags argument handling (#421) * improve gflags argument handling * fix lint failure * oops! * add a compat method * throw an error for bad flag * another lint --- CHANGELOG.md | 1 + lib/vips/gvalue.rb | 44 +++++++++++++++++++++++++++++++++++++++++--- lib/vips/image.rb | 10 +++++----- lib/vips/object.rb | 1 + spec/vips_spec.rb | 29 +++++++++++++++++++++++++++++ 5 files changed, 77 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 686cbe9..4a26601 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## master * improve NULL pointer handling [dloebl] +* improve GFlags argument handling [jcupitt] ## Version 2.2.4 (2025-06-05) diff --git a/lib/vips/gvalue.rb b/lib/vips/gvalue.rb index c6a1cb8..9b5340f 100644 --- a/lib/vips/gvalue.rb +++ b/lib/vips/gvalue.rb @@ -25,7 +25,7 @@ class GValue < FFI::ManagedStruct :data, [:ulong_long, 2] # convert an enum value (str/symb/int) into an int ready for libvips - def self.from_nick(gtype, value) + def self.enum_from_nick(gtype, value) value = value.to_s if value.is_a? Symbol if value.is_a? String @@ -40,6 +40,43 @@ def self.from_nick(gtype, value) value end + # compatibility ... we used to call it this, perhaps someone has used this + # internal method + def self.from_nick(gtype, value) + GValue.enum_from_nick(gtype, value) + end + + # convert an flags value (array[str/symb/int] | str/symb/int) into an + # int ready for libvips + def self.flags_from_nick(gtype, value) + if value.is_a? String + # libvips will parse strings like "sub|up" etc. + name = value.tr("_", "-") + value = Vips.vips_flags_from_nick "ruby-vips", gtype, name + else + value = [value] if !value.is_a? Array + + # convert each item to a set of bits, OR them together + result = 0 + value.map do |item| + item = item.to_s if item.is_a? Symbol + if item.is_a? String + name = item.tr("_", "-") + item = Vips.vips_flags_from_nick "ruby-vips", gtype, name + if item == -1 + raise Vips::Error + end + end + + result |= item + end + + value = result + end + + value + end + # convert an int enum back into a symbol def self.to_nick(gtype, enum_value) enum_name = Vips.vips_enum_nick gtype, enum_value @@ -148,10 +185,11 @@ def set value else case fundamental when GFLAGS_TYPE - ::GObject.g_value_set_flags self, value + flags_value = GValue.flags_from_nick(self[:gtype], value) + ::GObject.g_value_set_flags self, flags_value when GENUM_TYPE - enum_value = GValue.from_nick(self[:gtype], value) + enum_value = GValue.enum_from_nick(self[:gtype], value) ::GObject.g_value_set_enum self, enum_value when GOBJECT_TYPE diff --git a/lib/vips/image.rb b/lib/vips/image.rb index 9ee303a..9a0df71 100644 --- a/lib/vips/image.rb +++ b/lib/vips/image.rb @@ -114,12 +114,12 @@ def self.smap x, &block end def self.complex? format - format_number = GObject::GValue.from_nick BAND_FORMAT_TYPE, format + format_number = GObject::GValue.enum_from_nick BAND_FORMAT_TYPE, format Vips.vips_band_format_iscomplex(format_number) != 0 end def self.float? format - format_number = GObject::GValue.from_nick BAND_FORMAT_TYPE, format + format_number = GObject::GValue.enum_from_nick BAND_FORMAT_TYPE, format Vips.vips_band_format_isfloat(format_number) != 0 end @@ -380,7 +380,7 @@ def self.new_from_memory data, width, height, bands, format size = data.bytesize end - format_number = GObject::GValue.from_nick BAND_FORMAT_TYPE, format + format_number = GObject::GValue.enum_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? @@ -405,7 +405,7 @@ def self.new_from_memory data, width, height, bands, format # @param format [Symbol] band format # @return [Image] the loaded image def self.new_from_memory_copy data, width, height, bands, format - format_number = GObject::GValue.from_nick BAND_FORMAT_TYPE, format + format_number = GObject::GValue.enum_from_nick BAND_FORMAT_TYPE, format if data.is_a?(FFI::Pointer) if data.size == UNKNOWN_POINTER_SIZE @@ -1319,7 +1319,7 @@ def composite overlay, mode, **opts end mode = mode.map do |x| - GObject::GValue.from_nick Vips::BLEND_MODE_TYPE, x + GObject::GValue.enum_from_nick Vips::BLEND_MODE_TYPE, x end Vips::Image.composite([self] + overlay, mode, **opts) diff --git a/lib/vips/object.rb b/lib/vips/object.rb index 9541c6f..4ac23ab 100644 --- a/lib/vips/object.rb +++ b/lib/vips/object.rb @@ -125,6 +125,7 @@ class Progress < FFI::Struct attach_function :vips_enum_from_nick, [:string, :GType, :string], :int attach_function :vips_enum_nick, [:GType, :int], :string + attach_function :vips_flags_from_nick, [:string, :GType, :string], :int attach_function :vips_value_set_ref_string, [GObject::GValue.ptr, :string], :void diff --git a/spec/vips_spec.rb b/spec/vips_spec.rb index 3b8c407..c22f924 100644 --- a/spec/vips_spec.rb +++ b/spec/vips_spec.rb @@ -166,6 +166,35 @@ expect(rot.bands).to eq(1) end + it "can handle symbol flag arguments" do + black = Vips::Operation.call "black", [200, 200] + bytes = Vips::Operation.call "pngsave_buffer", [black], keep: :icc + + expect(bytes.length).to be > 100 + end + + it "can handle int flag arguments" do + black = Vips::Operation.call "black", [200, 200] + bytes = Vips::Operation.call "pngsave_buffer", [black], keep: 1 << 3 + + expect(bytes.length).to be > 100 + end + + it "can handle string flag arguments" do + black = Vips::Operation.call "black", [200, 200] + bytes = Vips::Operation.call "pngsave_buffer", [black], keep: "icc" + + expect(bytes.length).to be > 100 + end + + it "can handle array flag arguments" do + black = Vips::Operation.call "black", [200, 200] + bytes = Vips::Operation.call "pngsave_buffer", [black], + keep: [:icc, :xmp] + + expect(bytes.length).to be > 100 + end + it "can return optional output args" do point = Vips::Operation.call "black", [1, 1] test = Vips::Operation.call "embed", [point, 20, 10, 100, 100], From 24679e174da14cd84bed0e513330d56646694673 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 24 Jul 2025 18:45:32 +0100 Subject: [PATCH 20/21] Add missing enums (#422) * add missing flags sine we now have proper flags support * add missing flag and enum docs We'd not updated these for quite a while! I used the automatically-generated python enum docs as a guide. * fix lint --- CHANGELOG.md | 1 + lib/vips/combine.rb | 10 ++++++++++ lib/vips/fail_on.rb | 15 +++++++++++++++ lib/vips/foreign_dz_container.rb | 10 ++++++++++ lib/vips/foreign_dz_depth.rb | 10 ++++++++++ lib/vips/foreign_dz_layout.rb | 12 ++++++++++++ lib/vips/foreign_heif_compression.rb | 11 +++++++++++ lib/vips/foreign_heif_encoder.rb | 11 +++++++++++ lib/vips/foreign_keep.rb | 13 +++++++++++++ lib/vips/foreign_png_filter.rb | 13 +++++++++++++ lib/vips/foreign_ppm_format.rb | 12 ++++++++++++ lib/vips/foreign_subsample.rb | 10 ++++++++++ lib/vips/foreign_tiff_compression.rb | 16 ++++++++++++++++ lib/vips/foreign_tiff_predictor.rb | 10 ++++++++++ lib/vips/foreign_tiff_resunit.rb | 9 +++++++++ lib/vips/foreign_webp_preset.rb | 13 +++++++++++++ lib/vips/intent.rb | 12 ++++++++++++ lib/vips/interpretation.rb | 7 ++++--- lib/vips/kernel.rb | 15 +++++++++------ lib/vips/operation_morphology.rb | 9 +++++++++ lib/vips/pcs.rb | 10 ++++++++++ lib/vips/precision.rb | 10 ++++++++++ lib/vips/region_shrink.rb | 13 +++++++++++++ lib/vips/sdf_shape.rb | 11 +++++++++++ lib/vips/text_wrap.rb | 11 +++++++++++ 25 files changed, 265 insertions(+), 9 deletions(-) create mode 100644 lib/vips/combine.rb create mode 100644 lib/vips/fail_on.rb create mode 100644 lib/vips/foreign_dz_container.rb create mode 100644 lib/vips/foreign_dz_depth.rb create mode 100644 lib/vips/foreign_dz_layout.rb create mode 100644 lib/vips/foreign_heif_compression.rb create mode 100644 lib/vips/foreign_heif_encoder.rb create mode 100644 lib/vips/foreign_keep.rb create mode 100644 lib/vips/foreign_png_filter.rb create mode 100644 lib/vips/foreign_ppm_format.rb create mode 100644 lib/vips/foreign_subsample.rb create mode 100644 lib/vips/foreign_tiff_compression.rb create mode 100644 lib/vips/foreign_tiff_predictor.rb create mode 100644 lib/vips/foreign_tiff_resunit.rb create mode 100644 lib/vips/foreign_webp_preset.rb create mode 100644 lib/vips/intent.rb create mode 100644 lib/vips/operation_morphology.rb create mode 100644 lib/vips/pcs.rb create mode 100644 lib/vips/precision.rb create mode 100644 lib/vips/region_shrink.rb create mode 100644 lib/vips/sdf_shape.rb create mode 100644 lib/vips/text_wrap.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a26601..c7fe0ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * improve NULL pointer handling [dloebl] * improve GFlags argument handling [jcupitt] +* add missing flag and enum docs [jcupitt] ## Version 2.2.4 (2025-06-05) diff --git a/lib/vips/combine.rb b/lib/vips/combine.rb new file mode 100644 index 0000000..4bc7ef4 --- /dev/null +++ b/lib/vips/combine.rb @@ -0,0 +1,10 @@ +module Vips + # How to combine values, see for example {Image#compass}. + # + # * `:max` take the maximum of the possible values + # * `:sum` sum all the values + # * `:min` take the minimum value + + class Combine < Symbol + end +end diff --git a/lib/vips/fail_on.rb b/lib/vips/fail_on.rb new file mode 100644 index 0000000..520a2b7 --- /dev/null +++ b/lib/vips/fail_on.rb @@ -0,0 +1,15 @@ +module Vips + # How sensitive loaders are to errors, from never stop (very insensitive), + # to stop on the smallest warning (very sensitive). + # + # Each implies the ones before it, so `:error` implies `:truncated`, for + # example. + # + # * `:none` never stop + # * `:truncated` stop on image truncated, nothing else + # * `:error` stop on serious error or truncation + # * `:warning` stop on anything, even warnings + + class FailOn < Symbol + end +end diff --git a/lib/vips/foreign_dz_container.rb b/lib/vips/foreign_dz_container.rb new file mode 100644 index 0000000..d83d09f --- /dev/null +++ b/lib/vips/foreign_dz_container.rb @@ -0,0 +1,10 @@ +module Vips + # The container format to use + # + # * `:fs` write tiles to the filesystem + # * `:zip` write tiles to a zip file + # * `:szi` write to a szi file + + class ForeignDzContainer < Symbol + end +end diff --git a/lib/vips/foreign_dz_depth.rb b/lib/vips/foreign_dz_depth.rb new file mode 100644 index 0000000..f6f33af --- /dev/null +++ b/lib/vips/foreign_dz_depth.rb @@ -0,0 +1,10 @@ +module Vips + # How many pyramid layers to create. + # + # * `:onepixel` create layers down to 1x1 pixel + # * `:onetile` create layers down to 1x1 tile + # * `:one` only create a single layer + + class ForeignDzDepth < Symbol + end +end diff --git a/lib/vips/foreign_dz_layout.rb b/lib/vips/foreign_dz_layout.rb new file mode 100644 index 0000000..7503e18 --- /dev/null +++ b/lib/vips/foreign_dz_layout.rb @@ -0,0 +1,12 @@ +module Vips + # What directory layout and metadata standard to use. + # + # * `:dz` use DeepZoom directory layout + # * `:zoomify` use Zoomify directory layout + # * `:google` use Google maps directory layout + # * `:iiif` use IIIF v2 directory layout + # * `:iiif3` use IIIF v3 directory layout + + class ForeignDzLayout < Symbol + end +end diff --git a/lib/vips/foreign_heif_compression.rb b/lib/vips/foreign_heif_compression.rb new file mode 100644 index 0000000..0601e04 --- /dev/null +++ b/lib/vips/foreign_heif_compression.rb @@ -0,0 +1,11 @@ +module Vips + # The compression format to use inside a HEIF container + # + # * `:hevc` x265 + # * `:avc` x264 + # * `:jpeg` jpeg + # * `:av1` aom + + class ForeignHeifCompression < Symbol + end +end diff --git a/lib/vips/foreign_heif_encoder.rb b/lib/vips/foreign_heif_encoder.rb new file mode 100644 index 0000000..c3f3df8 --- /dev/null +++ b/lib/vips/foreign_heif_encoder.rb @@ -0,0 +1,11 @@ +module Vips + # The selected encoder to use. + # + # * `:auto` auto + # * `:rav1e` RAV1E + # * `:svt` SVT-AV1 + # * `:x265` x265 + + class ForeignHeifEncoder < Symbol + end +end diff --git a/lib/vips/foreign_keep.rb b/lib/vips/foreign_keep.rb new file mode 100644 index 0000000..26871e4 --- /dev/null +++ b/lib/vips/foreign_keep.rb @@ -0,0 +1,13 @@ +module Vips + # Savers can be given a set of metadata items to keep. + # + # * `:none` remove all metadata + # * `:exif` keep EXIF metadata + # * `:xmp` keep XMP metadata + # * `:iptc` keep IPTC metadata + # * `:icc` keep ICC profiles + # * `:other` keep other metadata + + class ForeignKeep < Symbol + end +end diff --git a/lib/vips/foreign_png_filter.rb b/lib/vips/foreign_png_filter.rb new file mode 100644 index 0000000..fb928bd --- /dev/null +++ b/lib/vips/foreign_png_filter.rb @@ -0,0 +1,13 @@ +module Vips + # The set of filters for PNG save. See http://www.w3.org/TR/PNG-Filters.html + # + # * `:none` no filtering + # * `:sub` difference to the left + # * `:up` difference up + # * `:avg` average of left and up + # * `:paeth` pick best neighbor predictor automatically + # * `:all` adaptive + + class ForeignPngFilter < Symbol + end +end diff --git a/lib/vips/foreign_ppm_format.rb b/lib/vips/foreign_ppm_format.rb new file mode 100644 index 0000000..4ef2827 --- /dev/null +++ b/lib/vips/foreign_ppm_format.rb @@ -0,0 +1,12 @@ +module Vips + # The netpbm file format to save as. + # + # * `:pbm` portable bitmap + # * `:pgm` portable greymap + # * `:ppm` portable pixmap + # * `:pfm` portable float map + # * `:pnm` portable anymap + + class ForeignPpmFormat < Symbol + end +end diff --git a/lib/vips/foreign_subsample.rb b/lib/vips/foreign_subsample.rb new file mode 100644 index 0000000..deb9f50 --- /dev/null +++ b/lib/vips/foreign_subsample.rb @@ -0,0 +1,10 @@ +module Vips + # Set subsampling mode. + # + # * `:auto` prevent subsampling when quality >= 90 + # * `:on` always perform subsampling + # * `:off` never perform subsampling + + class ForeignSubsample < Symbol + end +end diff --git a/lib/vips/foreign_tiff_compression.rb b/lib/vips/foreign_tiff_compression.rb new file mode 100644 index 0000000..b6aec3c --- /dev/null +++ b/lib/vips/foreign_tiff_compression.rb @@ -0,0 +1,16 @@ +module Vips + # The compression types supported by the tiff writer. + # + # * `:none` no compression + # * `:jpeg` jpeg compression + # * `:deflate` deflate (zip) compression + # * `:packbits` packbits compression + # * `:ccittfax4` fax4 compression + # * `:lzw` LZW compression + # * `:webp` WEBP compression + # * `:zstd` ZSTD compression + # * `:jp2k` JP2K compression + + class ForeignTiffCompression < Symbol + end +end diff --git a/lib/vips/foreign_tiff_predictor.rb b/lib/vips/foreign_tiff_predictor.rb new file mode 100644 index 0000000..3141558 --- /dev/null +++ b/lib/vips/foreign_tiff_predictor.rb @@ -0,0 +1,10 @@ +module Vips + # The predictor can help deflate and lzw compression. + # + # * `:none` no prediction + # * `:horizontal` horizontal differencing + # * `:float` float predictor + + class ForeignTiffPredictor < Symbol + end +end diff --git a/lib/vips/foreign_tiff_resunit.rb b/lib/vips/foreign_tiff_resunit.rb new file mode 100644 index 0000000..80c199f --- /dev/null +++ b/lib/vips/foreign_tiff_resunit.rb @@ -0,0 +1,9 @@ +module Vips + # Use inches or centimeters as the resolution unit for a tiff file. + # + # * `:cm` use centimeters + # * `:inch` use inches + + class ForeignTiffResunit < Symbol + end +end diff --git a/lib/vips/foreign_webp_preset.rb b/lib/vips/foreign_webp_preset.rb new file mode 100644 index 0000000..3e400df --- /dev/null +++ b/lib/vips/foreign_webp_preset.rb @@ -0,0 +1,13 @@ +module Vips + # Tune lossy encoder settings for different image types. + # + # * `:default` default preset + # * `:picture` digital picture, like portrait, inner shot + # * `:photo` outdoor photograph, with natural lighting + # * `:drawing` hand or line drawing, with high-contrast details + # * `:icon` small-sized colorful images + # * `:text` text-like + + class ForeignWebpPreset < Symbol + end +end diff --git a/lib/vips/intent.rb b/lib/vips/intent.rb new file mode 100644 index 0000000..8ce3622 --- /dev/null +++ b/lib/vips/intent.rb @@ -0,0 +1,12 @@ +module Vips + # The rendering intent. + # + # * `:perceptual` perceptual rendering intent + # * `:relative` relative colorimetric rendering intent + # * `:saturation` saturation rendering intent + # * `:absolute` absolute colorimetric rendering intent + # * `:auto` the rendering intent that the profile suggests + + class Intent < Symbol + end +end diff --git a/lib/vips/interpretation.rb b/lib/vips/interpretation.rb index 96f314e..9005311 100644 --- a/lib/vips/interpretation.rb +++ b/lib/vips/interpretation.rb @@ -6,7 +6,6 @@ module Vips # * `:multiband` generic many-band image # * `:b_w` some kind of single-band image # * `:histogram` a 1D image, eg. histogram or lookup table - # * `:fourier` image is in fourier space # * `:xyz` the first three bands are CIE XYZ # * `:lab` pixels are in CIE Lab space # * `:cmyk` the first four bands are in CMYK space @@ -16,12 +15,14 @@ module Vips # * `:lch` pixels are in CIE LCh space # * `:labs` CIE LAB coded as three signed 16-bit values # * `:srgb` pixels are sRGB - # * `:hsv` pixels are HSV - # * `:scrgb` pixels are scRGB # * `:yxy` pixels are CIE Yxy + # * `:fourier` image is in fourier space # * `:rgb16` generic 16-bit RGB # * `:grey16` generic 16-bit mono # * `:matrix` a matrix + # * `:scrgb` pixels are scRGB + # * `:hsv` pixels are HSV + class Interpretation < Symbol end end diff --git a/lib/vips/kernel.rb b/lib/vips/kernel.rb index 5c7a513..69cd913 100644 --- a/lib/vips/kernel.rb +++ b/lib/vips/kernel.rb @@ -4,16 +4,19 @@ module Vips # # At least these should be available: # - # * `:nearest` Nearest-neighbour interpolation. - # * `:linear` Linear interpolation. - # * `:cubic` Cubic interpolation. - # * `:lanczos2` Two-lobe Lanczos - # * `:lanczos3` Three-lobe Lanczos + # * `:nearest` nearest-neighbour interpolation + # * `:linear` linear interpolation + # * `:cubic` cubic interpolation + # * `:mitchell` Mitchell interpolation + # * `:lanczos2` two-lobe Lanczos + # * `:lanczos3` three-lobe Lanczos + # * `:mks2013` convolve with Magic Kernel Sharp 2013 + # * `:mks2021` convolve with Magic Kernel Sharp 2021 # # For example: # # ```ruby - # im = im.resize 3, :kernel => :lanczos2 + # im = im.resize 3, kernel: :lanczos2 # ``` class Kernel < Symbol diff --git a/lib/vips/operation_morphology.rb b/lib/vips/operation_morphology.rb new file mode 100644 index 0000000..02bc2bc --- /dev/null +++ b/lib/vips/operation_morphology.rb @@ -0,0 +1,9 @@ +module Vips + # Pick a morphological operator. + # + # * `:erode` true if all set + # * `:dilate` true if any set + + class OperationMorphology < Symbol + end +end diff --git a/lib/vips/pcs.rb b/lib/vips/pcs.rb new file mode 100644 index 0000000..1edb046 --- /dev/null +++ b/lib/vips/pcs.rb @@ -0,0 +1,10 @@ +module Vips + # Pick a Profile Connection Space for {Image#icc_import} and + # {Image#icc_export}`. + # + # * `:lab` use CIELAB D65 as the Profile Connection Space + # * `:xyz` use XYZ as the Profile Connection Space + + class PCS < Symbol + end +end diff --git a/lib/vips/precision.rb b/lib/vips/precision.rb new file mode 100644 index 0000000..01207be --- /dev/null +++ b/lib/vips/precision.rb @@ -0,0 +1,10 @@ +module Vips + # How accurate an operation should be. + # + # * `:integer` int everywhere + # * `:float` float everywhere + # * `:approximate` approximate integer output + + class Precision < Symbol + end +end diff --git a/lib/vips/region_shrink.rb b/lib/vips/region_shrink.rb new file mode 100644 index 0000000..13f556d --- /dev/null +++ b/lib/vips/region_shrink.rb @@ -0,0 +1,13 @@ +module Vips + # ow to calculate the output pixels when shrinking a 2x2 region. + # + # * `:mean` use the average + # * `:median` use the median + # * `:mode` use the mode + # * `:max` use the maximum + # * `:min` use the minimum + # * `:nearest` use the top-left pixel + + class RegionShrink < Symbol + end +end diff --git a/lib/vips/sdf_shape.rb b/lib/vips/sdf_shape.rb new file mode 100644 index 0000000..1ab35f0 --- /dev/null +++ b/lib/vips/sdf_shape.rb @@ -0,0 +1,11 @@ +module Vips + # The SDF to generate, see {Image.sdf}. + # + # * `:circle` a circle at @a, radius @r + # * `:box` a box from @a to @b + # * `:rounded_box` a box with rounded @corners from @a to @b + # * `:line` a line from @a to @b + + class SdfShape < Symbol + end +end diff --git a/lib/vips/text_wrap.rb b/lib/vips/text_wrap.rb new file mode 100644 index 0000000..53da2db --- /dev/null +++ b/lib/vips/text_wrap.rb @@ -0,0 +1,11 @@ +module Vips + # Sets the word wrapping style for {Image#text} when used with a + # maximum width. + # + # * `:char` wrap at character boundaries + # * `:word_char` wrap at word boundaries, but fall back to character boundaries if there is not enough space for a full word + # * `:none` no wrapping + + class TextWrap < Symbol + end +end From 6def9e8a34f87fec133f2ccdc04513c7559e91ba Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 24 Jul 2025 18:53:21 +0100 Subject: [PATCH 21/21] add note on new flags API to docs --- lib/vips.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/vips.rb b/lib/vips.rb index aed3f1a..06447ac 100644 --- a/lib/vips.rb +++ b/lib/vips.rb @@ -452,6 +452,19 @@ module GObject # like `:uchar`. They are documented as a set of classes for convenience, see # {Vips::BandFormat}, for example. # +# # Flags +# +# Some operations take a set of flags as an argument, for example +# {Image#pngsave} can be given a set of filters to use. These are documented +# as a set of classes, see {Vips::ForeignPngFilter}, for +# example. +# +# You can set flag arguments with an array of symbols, perhaps: +# +# ```ruby +# image.pngsave "x.png", filter: [:sub, :up] +# ``` +# # # Draw operations # # There are two ways of calling the libvips draw operations, like