vips 8.12.1 → 8.12.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 872a3771eee6d56c17254a27013a7ff1d002506965bf488fad3d055817457f1a
4
- data.tar.gz: 76930aa9a3b5456460be220e3373c3a7ff573a86f18c3e07a3cd4ebbf37614af
3
+ metadata.gz: 04f3fd36552bb4da990741e7ceabd7c3d45d1f9e46922cdc9395d4eef642ad03
4
+ data.tar.gz: 448cf9fa2b624c8867d030ed6403b5d4573671a260a2618cf7eed4bf62f1afa8
5
5
  SHA512:
6
- metadata.gz: 51239e27dfe2b430985f875150abc758f2f4756fca00647e4c976ff36e4569da42a67bf236988bb244c3e4c8d2043d1d2308baceb58833accb0434460fc2ca87
7
- data.tar.gz: 11e11cfdece5955686490f861ef20abcfd283d1d2875f5c7212cfabd0bf03aff8589e085e9277b61cd8d0bb71fef6db309617d93134590e574b6817722637d81
6
+ metadata.gz: fc0f77d035c10ee9760c8c96e4dad26bf776d272e23360b24a4e15e0d6bcc5fdb26cda7e05900b7acd52ab62e602a6a3710be7b1b12b0de6cbcf1d96e88726bf
7
+ data.tar.gz: e88b05b9b2382d7ecc3ef061a3e96a4a35013e232da294d963b9765ebd0204598352dcda4a09b3f83bdc31538021be8506f17ac5af03f0aeec5ec7f39abdcb2a
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## master
4
4
 
5
+ * add `draw_point!` [jcupitt]
6
+ * add `Vips.tracked_*` for getting file and memory metrics [jeremy]
7
+ * add `Vips.cache_*` for getting cache settings [jeremy]
8
+ * add `Vips.vector?` to get/set SIMD status [jeremy]
9
+ * add `Vips.concurrency` to get/set threadpool size [jeremy]
10
+ * add `Vips.concurrency_default` to get the default threadpool size [jeremy]
11
+
5
12
  ## Version 2.1.4 (2021-10-28)
6
13
 
7
14
  * `write_to_buffer` tries to use the new target API, then falls back to the old
data/Gemfile CHANGED
@@ -4,8 +4,8 @@ source "https://rubygems.org"
4
4
  gemspec
5
5
 
6
6
  group :maintenance, optional: true do
7
- gem "bake"
8
- gem "bake-gem"
7
+ gem "bake"
8
+ gem "bake-gem"
9
9
  end
10
10
 
11
11
  gem "github-markup"
data/README.md CHANGED
@@ -1,9 +1,15 @@
1
1
  # Vips
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/ruby-vips.svg)](https://badge.fury.io/rb/ruby-vips)
4
- [![Test](https://github.com/libvips/ruby-vips/workflows/Test/badge.svg)](https://github.com/libvips/ruby-vips/actions?query=workflow%3ATest)
3
+ [![Development](https://github.com/ioquatix/vips/workflows/Development/badge.svg)](https://github.com/libvips/ruby-vips/actions?query=workflow%3ATest)
5
4
 
6
- This gem is a backwards compatible fork of `ruby-vips` but also includes (and compiles) the [libvips] source code.
5
+ This gem is a Ruby binding for the [libvips image processing
6
+ library](https://libvips.github.io/libvips). It has been tested on
7
+ Linux, macOS and Windows, and with ruby 2, ruby 3 and jruby. It uses
8
+ [ruby-ffi](https://github.com/ffi/ffi) to call functions in the libvips
9
+ library.
10
+
11
+ This fork is compatible witih `ruby-vips` but also includes (and compiles)
12
+ the [libvips] source code.
7
13
 
8
14
  libvips is a [demand-driven, horizontally
9
15
  threaded](https://github.com/libvips/libvips/wiki/Why-is-libvips-quick)
@@ -13,14 +19,32 @@ memory](https://github.com/libvips/libvips/wiki/Speed-and-memory-use).
13
19
  libvips is licensed under the [LGPL
14
20
  2.1+](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html).
15
21
 
16
- [libvips]: https://libvips.github.io/libvips
22
+ ## Install on linux and macOS
17
23
 
18
- ## Installation
24
+ Install the libvips binary with your package manager (eg. `apt install
25
+ libvips42` or perhaps `brew install vips`, see the [libvips install
26
+ instructions](https://libvips.github.io/libvips/install.html)) then install
27
+ this gem with:
19
28
 
20
29
  ``` shell
21
30
  $ bundle add vips
22
31
  ```
23
32
 
33
+ ## Install on Windows
34
+
35
+ The gemspec will pull in the msys libvips for you.
36
+
37
+ Tested with the ruby and msys from choco, but others may work.
38
+
39
+ ## Example
40
+
41
+ ```ruby
42
+ require "vips"
43
+
44
+ Or install it yourself as:
45
+
46
+ $ gem install vips
47
+
24
48
  You'll still need to install `glib` and `gobject-introspection`.
25
49
 
26
50
  ## Usage
@@ -96,6 +96,13 @@ module Vips
96
96
  Vips::Operation.call name.to_s, [self, *args], options
97
97
  end
98
98
 
99
+ # Draw a point on an image.
100
+ #
101
+ # See {Image#draw_rect}.
102
+ def draw_point! ink, left, top, **opts
103
+ draw_rect! ink, left, top, 1, 1, **opts
104
+ end
105
+
99
106
  # Create a metadata item on an image of the specifed type. Ruby types
100
107
  # are automatically transformed into the matching glib type (eg.
101
108
  # {GObject::GINT_TYPE}), if possible.
data/lib/vips/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Vips
3
- VERSION = "8.12.1"
3
+ VERSION = "8.12.2"
4
4
  end
data/lib/vips.rb CHANGED
@@ -27,9 +27,9 @@ def library_name(name, abi_number)
27
27
  if FFI::Platform.windows?
28
28
  "lib#{name}-#{abi_number}.dll"
29
29
  elsif FFI::Platform.mac?
30
- "#{name}.#{abi_number}"
30
+ "lib#{name}.#{abi_number}.dylib"
31
31
  else
32
- "#{name}.so.#{abi_number}"
32
+ "lib#{name}.so.#{abi_number}"
33
33
  end
34
34
  end
35
35
 
@@ -570,7 +570,7 @@ require "vips/gvalue"
570
570
  module Vips
571
571
  extend FFI::Library
572
572
 
573
- ffi_lib library_name("vips", 42)
573
+ ffi_lib File.expand_path(library_name("vips", 42), __dir__)
574
574
 
575
575
  LOG_DOMAIN = "VIPS"
576
576
  GLib.set_log_domain LOG_DOMAIN
@@ -625,7 +625,12 @@ module Vips
625
625
 
626
626
  attach_function :vips_leak_set, [:int], :void
627
627
  attach_function :vips_vector_set_enabled, [:int], :void
628
+ attach_function :vips_vector_isenabled, [], :int
628
629
  attach_function :vips_concurrency_set, [:int], :void
630
+ attach_function :vips_concurrency_get, [], :int
631
+
632
+ # Track the original default concurrency so we can reset to it.
633
+ DEFAULT_CONCURRENCY = vips_concurrency_get
629
634
 
630
635
  # vips_foreign_get_suffixes was added in libvips 8.8
631
636
  begin
@@ -640,20 +645,66 @@ module Vips
640
645
  vips_leak_set((leak ? 1 : 0))
641
646
  end
642
647
 
648
+ attach_function :vips_tracked_get_mem, [], :int
649
+ attach_function :vips_tracked_get_mem_highwater, [], :int
650
+ attach_function :vips_tracked_get_allocs, [], :int
651
+ attach_function :vips_tracked_get_files, [], :int
652
+ attach_function :vips_cache_get_max, [], :int
653
+ attach_function :vips_cache_get_max_mem, [], :int
654
+ attach_function :vips_cache_get_max_files, [], :int
643
655
  attach_function :vips_cache_set_max, [:int], :void
644
656
  attach_function :vips_cache_set_max_mem, [:int], :void
645
657
  attach_function :vips_cache_set_max_files, [:int], :void
658
+ attach_function :vips_cache_print, [], :void
659
+ attach_function :vips_cache_drop_all, [], :void
660
+
661
+ # Get the number of bytes currently allocated via vips_malloc.
662
+ def self.tracked_mem
663
+ vips_tracked_get_mem
664
+ end
665
+
666
+ # Get the greatest number of bytes ever actively allocated via vips_malloc.
667
+ def self.tracked_mem_highwater
668
+ vips_tracked_get_mem_highwater
669
+ end
670
+
671
+ # Get the number of active allocations.
672
+ def self.tracked_allocs
673
+ vips_tracked_get_allocs
674
+ end
675
+
676
+ # Get the number of open files.
677
+ def self.tracked_files
678
+ vips_tracked_get_files
679
+ end
680
+
681
+ # Get the maximum number of operations that libvips should cache.
682
+ def self.cache_max
683
+ vips_cache_get_max
684
+ end
685
+
686
+ # Get the maximum amount of memory that libvips uses for the operation cache.
687
+ def self.cache_max_mem
688
+ vips_cache_get_max_mem
689
+ end
690
+
691
+ # Get the maximum number of files libvips keeps open in the operation cache.
692
+ def self.cache_max_files
693
+ vips_cache_get_max_files
694
+ end
646
695
 
647
696
  # Set the maximum number of operations that libvips should cache. Set 0 to
648
697
  # disable the operation cache. The default is 1000.
649
698
  def self.cache_set_max size
650
699
  vips_cache_set_max size
700
+ cache_max
651
701
  end
652
702
 
653
703
  # Set the maximum amount of memory that libvips should use for the operation
654
704
  # cache. Set 0 to disable the operation cache. The default is 100mb.
655
705
  def self.cache_set_max_mem size
656
706
  vips_cache_set_max_mem size
707
+ cache_max_mem
657
708
  end
658
709
 
659
710
  # Set the maximum number of files libvips should keep open in the
@@ -661,12 +712,43 @@ module Vips
661
712
  # 100.
662
713
  def self.cache_set_max_files size
663
714
  vips_cache_set_max_files size
715
+ cache_max_files
716
+ end
717
+
718
+ # Print the libvips operation cache to stdout. Handy for debugging.
719
+ def self.cache_print # :nodoc:
720
+ vips_cache_print
721
+ end
722
+
723
+ # Drop the libvips operation cache. Handy for leak tracking.
724
+ def self.cache_drop_all # :nodoc:
725
+ vips_cache_drop_all
726
+ end
727
+
728
+ # Get the size of libvips worker pools. Defaults to the VIPS_CONCURRENCY env
729
+ # var or the number of hardware threads on your computer.
730
+ def self.concurrency
731
+ vips_concurrency_get
664
732
  end
665
733
 
666
- # Set the size of the libvips worker pool. This defaults to the number of
667
- # hardware threads on your computer. Set to 1 to disable threading.
734
+ # Get the default size of libvips worker pools.
735
+ def self.concurrency_default
736
+ DEFAULT_CONCURRENCY
737
+ end
738
+
739
+ # Set the size of each libvips worker pool. Max 1024 threads. Set to 1 to
740
+ # disable threading. Set to 0 or nil to reset to default.
668
741
  def self.concurrency_set n
742
+ n = DEFAULT_CONCURRENCY if n.to_i == 0
669
743
  vips_concurrency_set n
744
+ concurrency
745
+ end
746
+
747
+ # Whether SIMD and the run-time compiler are enabled. This can give a nice
748
+ # speed-up, but can also be unstable on some systems or with some versions
749
+ # of the run-time compiler.
750
+ def self.vector?
751
+ vips_vector_isenabled == 1
670
752
  end
671
753
 
672
754
  # Enable or disable SIMD and the run-time compiler. This can give a nice
@@ -674,6 +756,7 @@ module Vips
674
756
  # of the run-time compiler.
675
757
  def self.vector_set enabled
676
758
  vips_vector_set_enabled(enabled ? 1 : 0)
759
+ vector?
677
760
  end
678
761
 
679
762
  # Deprecated compatibility function.
data/vips.gemspec CHANGED
@@ -15,22 +15,21 @@ Gem::Specification.new do |spec|
15
15
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
16
  f.match(%r{^(test|spec|features)/})
17
17
  end
18
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.required_ruby_version = ">= 2.1"
22
22
 
23
23
  spec.extensions = %w[ext/Rakefile]
24
24
 
25
- spec.add_runtime_dependency "ffi", ["~> 1.12"]
25
+ spec.add_runtime_dependency "ffi", "~> 1.12"
26
26
 
27
- spec.add_development_dependency "yard", "~> 0.8"
28
- spec.add_development_dependency "redcarpet", "~> 3.3"
29
- spec.add_development_dependency "github-markup", "~> 1.4"
27
+ spec.add_development_dependency "rake", "~> 13.0"
28
+ spec.add_development_dependency "rspec", "~> 3.3"
29
+ spec.add_development_dependency "yard", "~> 0.9.11"
30
+ spec.add_development_dependency "bundler", ">= 1.0"
30
31
 
31
- spec.add_development_dependency "bundler"
32
- spec.add_development_dependency "rspec", "~> 3.7"
33
- spec.add_development_dependency "rake"
34
-
35
- spec.add_development_dependency "standardrb"
32
+ if Gem.ruby_version >= Gem::Version.new("2.2")
33
+ spec.add_development_dependency "standard"
34
+ end
36
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vips
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.12.1
4
+ version: 8.12.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Cupitt
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-01-09 00:00:00.000000000 Z
12
+ date: 2022-06-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
@@ -26,21 +26,21 @@ dependencies:
26
26
  - !ruby/object:Gem::Version
27
27
  version: '1.12'
28
28
  - !ruby/object:Gem::Dependency
29
- name: yard
29
+ name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0.8'
34
+ version: '13.0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0.8'
41
+ version: '13.0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: redcarpet
43
+ name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
@@ -54,63 +54,35 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  version: '3.3'
56
56
  - !ruby/object:Gem::Dependency
57
- name: github-markup
57
+ name: yard
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '1.4'
62
+ version: 0.9.11
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '1.4'
69
+ version: 0.9.11
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: bundler
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '0'
84
- - !ruby/object:Gem::Dependency
85
- name: rspec
86
- requirement: !ruby/object:Gem::Requirement
87
- requirements:
88
- - - "~>"
89
- - !ruby/object:Gem::Version
90
- version: '3.7'
91
- type: :development
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - "~>"
96
- - !ruby/object:Gem::Version
97
- version: '3.7'
98
- - !ruby/object:Gem::Dependency
99
- name: rake
100
- requirement: !ruby/object:Gem::Requirement
101
- requirements:
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- version: '0'
76
+ version: '1.0'
105
77
  type: :development
106
78
  prerelease: false
107
79
  version_requirements: !ruby/object:Gem::Requirement
108
80
  requirements:
109
81
  - - ">="
110
82
  - !ruby/object:Gem::Version
111
- version: '0'
83
+ version: '1.0'
112
84
  - !ruby/object:Gem::Dependency
113
- name: standardrb
85
+ name: standard
114
86
  requirement: !ruby/object:Gem::Requirement
115
87
  requirements:
116
88
  - - ">="
@@ -217,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
217
189
  - !ruby/object:Gem::Version
218
190
  version: '0'
219
191
  requirements: []
220
- rubygems_version: 3.2.32
192
+ rubygems_version: 3.3.7
221
193
  signing_key:
222
194
  specification_version: 4
223
195
  summary: Vips is a high-performance image manipulation library.