ruby-vips 2.1.4 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/test.yml +16 -31
- data/CHANGELOG.md +33 -0
- data/README.md +18 -18
- data/TODO +1 -2
- data/VERSION +1 -1
- data/example/revalidate.rb +39 -0
- data/lib/vips/image.rb +15 -8
- data/lib/vips/interpolate.rb +3 -3
- data/lib/vips/methods.rb +679 -365
- data/lib/vips/mutableimage.rb +8 -1
- data/lib/vips/object.rb +1 -3
- data/lib/vips/operation.rb +16 -11
- data/lib/vips/region.rb +3 -3
- data/lib/vips/sourcecustom.rb +1 -1
- data/lib/vips/targetcustom.rb +1 -1
- data/lib/vips/version.rb +1 -1
- data/lib/vips.rb +145 -7
- data/ruby-vips.gemspec +1 -0
- metadata +19 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4bfc7ec785c930f9f11566a241b0b811c20ada01d38ef9dda7761f0daeb1efd
|
4
|
+
data.tar.gz: 618efc35ab3e798be637da9cead6aff9c8654162054a4104d71ff339348116c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49b7080c073a31214510bf56ed3cac7d18f5a1aa336b8f517867bab65bfc11b255f6184fddad564e363ae2f9f9bf17deecee6dffcb31af93b64f3a9162801575
|
7
|
+
data.tar.gz: c1253b94ac98fe8d9617d66dc4c47b41021c0f51497b6577dfad020a5e6898b36fee0baa8762e4b3b80ce697e4062fd71c258beb050ec81fb94a767954481040
|
data/.github/workflows/test.yml
CHANGED
@@ -1,13 +1,6 @@
|
|
1
1
|
name: Test
|
2
2
|
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- master
|
7
|
-
pull_request:
|
8
|
-
pull_request_target:
|
9
|
-
branches:
|
10
|
-
- master
|
3
|
+
on: [push, pull_request]
|
11
4
|
|
12
5
|
env:
|
13
6
|
NOKOGIRI_USE_SYSTEM_LIBRARIES: true
|
@@ -20,7 +13,7 @@ jobs:
|
|
20
13
|
|
21
14
|
steps:
|
22
15
|
- name: Checkout code
|
23
|
-
uses: actions/checkout@
|
16
|
+
uses: actions/checkout@v4
|
24
17
|
|
25
18
|
- name: Set up Ruby
|
26
19
|
uses: ruby/setup-ruby@v1
|
@@ -36,17 +29,17 @@ jobs:
|
|
36
29
|
|
37
30
|
strategy:
|
38
31
|
matrix:
|
39
|
-
os-version: [ 'ubuntu-
|
32
|
+
os-version: [ 'ubuntu-24.04' ]
|
40
33
|
ruby-version:
|
41
|
-
- 2.
|
42
|
-
- 2.
|
43
|
-
- 2.
|
44
|
-
- 2.
|
45
|
-
- 2.
|
46
|
-
-
|
47
|
-
-
|
48
|
-
- 2
|
49
|
-
- 3.
|
34
|
+
- '2.3'
|
35
|
+
- '2.4'
|
36
|
+
- '2.5'
|
37
|
+
- '2.6'
|
38
|
+
- '2.7'
|
39
|
+
- '3.0'
|
40
|
+
- '3.1'
|
41
|
+
- '3.2'
|
42
|
+
- '3.3'
|
50
43
|
- jruby
|
51
44
|
fail-fast: true
|
52
45
|
|
@@ -54,7 +47,7 @@ jobs:
|
|
54
47
|
|
55
48
|
steps:
|
56
49
|
- name: Checkout code
|
57
|
-
uses: actions/checkout@
|
50
|
+
uses: actions/checkout@v4
|
58
51
|
|
59
52
|
- name: Set up Ruby
|
60
53
|
uses: ruby/setup-ruby@v1
|
@@ -62,19 +55,11 @@ jobs:
|
|
62
55
|
ruby-version: ${{ matrix.ruby-version }}
|
63
56
|
bundler-cache: true
|
64
57
|
|
65
|
-
- name: Update apt
|
66
|
-
env:
|
67
|
-
DEBIAN_FRONTEND: noninteractive
|
68
|
-
run:
|
69
|
-
sudo apt-get update -qq -o Acquire::Retries=3
|
70
|
-
|
71
58
|
- name: Install libvips
|
72
|
-
|
73
|
-
|
74
|
-
run:
|
59
|
+
run: |
|
60
|
+
sudo apt-get update
|
75
61
|
# we only need the library
|
76
|
-
sudo apt-get install --
|
77
|
-
libvips
|
62
|
+
sudo apt-get install --no-install-recommends libvips
|
78
63
|
|
79
64
|
- name: Run Tests
|
80
65
|
run: bundle exec rake spec
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,39 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## Version 2.2.4 (2025-06-05)
|
6
|
+
|
7
|
+
* fix write to target test with libvips 8.17 [jcupitt]
|
8
|
+
* update docs for libvips 8.17 [jcupitt]
|
9
|
+
|
10
|
+
## Version 2.2.3 (2025-02-06)
|
11
|
+
|
12
|
+
* fix `Image#add_alpha()` with libvips 8.16 [kleisauke]
|
13
|
+
* fix FFI function definitions for `gboolean` parameters [kleisauke]
|
14
|
+
|
15
|
+
## Version 2.2.2 (2024-07-17)
|
16
|
+
|
17
|
+
* fix compat with unified (semistatic) libvips binaries [kleisauke]
|
18
|
+
|
19
|
+
## Version 2.2.1 (2024-02-21)
|
20
|
+
|
21
|
+
* add `Vips.block_untrusted` method to block all untrusted operations. Only for libvips >= 8.13. [Docs](https://www.libvips.org/API/current/libvips-vips.html#vips-block-untrusted-set). [#382](https://github.com/libvips/ruby-vips/pull/382) [aglushkov](https://github.com/aglushkov)
|
22
|
+
* add `Vips.block` method to block specific operation. Only for libvips >= 8.13. [Docs](https://www.libvips.org/API/current/VipsOperation.html#vips-operation-block-set). [#382](https://github.com/libvips/ruby-vips/pull/382) [aglushkov](https://github.com/aglushkov)
|
23
|
+
* `new_from_source` keeps a ref to the source object [taylorthurlow]
|
24
|
+
* some fixes to object references system
|
25
|
+
|
26
|
+
## Version 2.2.0 (2023-10-18)
|
27
|
+
|
28
|
+
* add `draw_point!` [jcupitt]
|
29
|
+
* add `Vips.tracked_*` for getting file and memory metrics [jeremy]
|
30
|
+
* add `Vips.cache_*` for getting cache settings [jeremy]
|
31
|
+
* add `Vips.vector?` to get/set SIMD status [jeremy]
|
32
|
+
* add `Vips.concurrency` to get/set threadpool size [jeremy]
|
33
|
+
* add `Vips.concurrency_default` to get the default threadpool size [jeremy]
|
34
|
+
* fix targetcustom spec test with libvips 8.13 [lucaskanashiro]
|
35
|
+
* add ruby 3.2 to CI [petergoldstein]
|
36
|
+
* update docs for libvips 8.15 [jcupitt]
|
37
|
+
|
5
38
|
## Version 2.1.4 (2021-10-28)
|
6
39
|
|
7
40
|
* `write_to_buffer` tries to use the new target API, then falls back to the old
|
data/README.md
CHANGED
@@ -4,7 +4,10 @@
|
|
4
4
|
[](https://github.com/libvips/ruby-vips/actions?query=workflow%3ATest)
|
5
5
|
|
6
6
|
This gem is a Ruby binding for the [libvips image processing
|
7
|
-
library](https://libvips.github.io/libvips).
|
7
|
+
library](https://libvips.github.io/libvips). It has been tested on
|
8
|
+
Linux, macOS and Windows, and with ruby 2, ruby 3 and jruby. It uses
|
9
|
+
[ruby-ffi](https://github.com/ffi/ffi) to call functions in the libvips
|
10
|
+
library.
|
8
11
|
|
9
12
|
libvips is a [demand-driven, horizontally
|
10
13
|
threaded](https://github.com/libvips/libvips/wiki/Why-is-libvips-quick)
|
@@ -14,32 +17,30 @@ memory](https://github.com/libvips/libvips/wiki/Speed-and-memory-use).
|
|
14
17
|
libvips is licensed under the [LGPL
|
15
18
|
2.1+](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html).
|
16
19
|
|
17
|
-
##
|
20
|
+
## Install on linux and macOS
|
18
21
|
|
19
|
-
|
22
|
+
Install the libvips binary with your package manager (eg. `apt install
|
23
|
+
libvips42` or perhaps `brew install vips`, see the [libvips install
|
24
|
+
instructions](https://libvips.github.io/libvips/install.html)) then install
|
25
|
+
this gem with:
|
20
26
|
|
21
|
-
|
22
|
-
|
23
|
-
|
27
|
+
```
|
28
|
+
gem install ruby-vips
|
29
|
+
```
|
24
30
|
|
25
|
-
|
31
|
+
Or include `gem "ruby-vips"` in your gemfile.
|
26
32
|
|
27
|
-
## Install
|
33
|
+
## Install on Windows
|
28
34
|
|
29
|
-
|
35
|
+
The gemspec will pull in the msys libvips for you, so all you need is:
|
30
36
|
|
31
37
|
```
|
32
|
-
|
38
|
+
gem install ruby-vips
|
33
39
|
```
|
34
40
|
|
35
|
-
|
41
|
+
Or include `gem "ruby-vips"` in your gemfile.
|
36
42
|
|
37
|
-
|
38
|
-
gem "ruby-vips"
|
39
|
-
```
|
40
|
-
|
41
|
-
On Windows, you'll need to set the `RUBY_DLL_PATH` environment variable to
|
42
|
-
point to the libvips bin directory.
|
43
|
+
Tested with the ruby and msys from choco, but others may work.
|
43
44
|
|
44
45
|
## Example
|
45
46
|
|
@@ -106,4 +107,3 @@ rmagick.rb 788768
|
|
106
107
|
|
107
108
|
See also [benchmarks at the official libvips
|
108
109
|
website](https://github.com/libvips/libvips/wiki/Speed-and-memory-use).
|
109
|
-
|
data/TODO
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.2.4
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# demo the "revalidate" feature in libvips 8.15
|
4
|
+
|
5
|
+
require "fileutils"
|
6
|
+
require "vips"
|
7
|
+
|
8
|
+
if ARGV.length != 2
|
9
|
+
puts "usage: ./revalidate.rb IMAGE-FILE-1 IMAGE-FILE-2"
|
10
|
+
exit 1
|
11
|
+
end
|
12
|
+
|
13
|
+
if File.exist?("fred")
|
14
|
+
puts "file 'fred' exists, delete it first"
|
15
|
+
exit 1
|
16
|
+
end
|
17
|
+
|
18
|
+
puts "copying #{ARGV[0]} to fred ..."
|
19
|
+
FileUtils.cp(ARGV[0], "fred")
|
20
|
+
|
21
|
+
image1 = Vips::Image.new_from_file("fred")
|
22
|
+
puts "fred.width = #{image1.width}"
|
23
|
+
|
24
|
+
puts "copying #{ARGV[1]} to fred ..."
|
25
|
+
FileUtils.cp(ARGV[1], "fred")
|
26
|
+
|
27
|
+
puts "plain image open ..."
|
28
|
+
image2 = Vips::Image.new_from_file("fred")
|
29
|
+
puts "fred.width = #{image2.width}"
|
30
|
+
|
31
|
+
puts "opening with revalidate ..."
|
32
|
+
image2 = Vips::Image.new_from_file("fred", revalidate: true)
|
33
|
+
puts "fred.width = #{image2.width}"
|
34
|
+
|
35
|
+
puts "opening again, should get cached entry ..."
|
36
|
+
image2 = Vips::Image.new_from_file("fred")
|
37
|
+
puts "fred.width = #{image2.width}"
|
38
|
+
|
39
|
+
File.delete("fred")
|
data/lib/vips/image.rb
CHANGED
@@ -14,8 +14,8 @@ module Vips
|
|
14
14
|
|
15
15
|
attach_function :vips_image_copy_memory, [:pointer], :pointer
|
16
16
|
|
17
|
-
attach_function :vips_image_set_progress, [:pointer, :
|
18
|
-
attach_function :vips_image_set_kill, [:pointer, :
|
17
|
+
attach_function :vips_image_set_progress, [:pointer, :int], :void
|
18
|
+
attach_function :vips_image_set_kill, [:pointer, :int], :void
|
19
19
|
|
20
20
|
attach_function :vips_filename_get_filename, [:string], :pointer
|
21
21
|
attach_function :vips_filename_get_options, [:string], :pointer
|
@@ -138,14 +138,14 @@ module Vips
|
|
138
138
|
image = image.cast :float
|
139
139
|
end
|
140
140
|
|
141
|
-
new_format = image.format == :double ? :dpcomplex : :complex
|
141
|
+
new_format = (image.format == :double) ? :dpcomplex : :complex
|
142
142
|
image = image.copy format: new_format, bands: image.bands / 2
|
143
143
|
end
|
144
144
|
|
145
145
|
image = block.call(image)
|
146
146
|
|
147
147
|
unless Image.complex? original_format
|
148
|
-
new_format = image.format == :dpcomplex ? :double : :float
|
148
|
+
new_format = (image.format == :dpcomplex) ? :double : :float
|
149
149
|
image = image.copy format: new_format, bands: image.bands * 2
|
150
150
|
end
|
151
151
|
|
@@ -458,7 +458,14 @@ module Vips
|
|
458
458
|
loader = Vips.vips_foreign_find_load_source source
|
459
459
|
raise Vips::Error if loader.nil?
|
460
460
|
|
461
|
-
Vips::Operation.call loader, [source], opts, option_string
|
461
|
+
result = Vips::Operation.call loader, [source], opts, option_string
|
462
|
+
|
463
|
+
# keep a secret ref to the source object ... the libvips loader will
|
464
|
+
# keep a ref to the C source object, but we need the ruby wrapper object
|
465
|
+
# to stay alive too
|
466
|
+
result.references << source
|
467
|
+
|
468
|
+
result
|
462
469
|
end
|
463
470
|
|
464
471
|
def self.matrix_from_array width, height, array
|
@@ -709,7 +716,7 @@ module Vips
|
|
709
716
|
# @see Object#signal_connect
|
710
717
|
# @param state [Boolean] progress signalling state
|
711
718
|
def set_progress state
|
712
|
-
Vips.vips_image_set_progress
|
719
|
+
Vips.vips_image_set_progress(self, state ? 1 : 0)
|
713
720
|
end
|
714
721
|
|
715
722
|
# Kill computation of this time.
|
@@ -720,7 +727,7 @@ module Vips
|
|
720
727
|
# @see Object#signal_connect
|
721
728
|
# @param kill [Boolean] stop computation
|
722
729
|
def set_kill kill
|
723
|
-
Vips.vips_image_set_kill
|
730
|
+
Vips.vips_image_set_kill(self, kill ? 1 : 0)
|
724
731
|
end
|
725
732
|
|
726
733
|
# Get the `GType` of a metadata field. The result is 0 if no such field
|
@@ -966,7 +973,7 @@ module Vips
|
|
966
973
|
# @return [Image] new image
|
967
974
|
def add_alpha
|
968
975
|
ptr = GenericPtr.new
|
969
|
-
result = Vips.vips_addalpha self, ptr
|
976
|
+
result = Vips.vips_addalpha self, ptr, :pointer, nil
|
970
977
|
raise Vips::Error if result != 0
|
971
978
|
|
972
979
|
Vips::Image.new ptr[:value]
|
data/lib/vips/interpolate.rb
CHANGED
@@ -49,10 +49,10 @@ module Vips
|
|
49
49
|
|
50
50
|
def initialize name
|
51
51
|
name = name.to_s if name.is_a? Symbol
|
52
|
-
|
53
|
-
raise Vips::Error if
|
52
|
+
pointer = Vips.vips_interpolate_new name
|
53
|
+
raise Vips::Error if pointer.nil?
|
54
54
|
|
55
|
-
super
|
55
|
+
super(pointer)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|