vips 8.8.4 → 8.12.1

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: 1e63e0ca10ce7e3c41bfda60bea2a13f12d13937c5ccab8be832648ed3d4aa6c
4
- data.tar.gz: 9e40c91344b418e24aed13952f335bb5b6a08dd015e675597e656650ce4bd2a9
3
+ metadata.gz: 872a3771eee6d56c17254a27013a7ff1d002506965bf488fad3d055817457f1a
4
+ data.tar.gz: 76930aa9a3b5456460be220e3373c3a7ff573a86f18c3e07a3cd4ebbf37614af
5
5
  SHA512:
6
- metadata.gz: 85aa8d1d02d8d91cdc33a2b012a2340f7b93aed72e3e6081ed3012ed7d0a8f605ec64a0a523d77a1add4cb6be15dfe2982d72d8770226c09547b39d3d6680145
7
- data.tar.gz: de62d6c3d576d3d0c34e0f391a6e720412152aafe672db9f2df148d34b948059f23402e2af4393421129efbfb2d414fb93b74bd1c50e0599fc367f73adf5fc83
6
+ metadata.gz: 51239e27dfe2b430985f875150abc758f2f4756fca00647e4c976ff36e4569da42a67bf236988bb244c3e4c8d2043d1d2308baceb58833accb0434460fc2ca87
7
+ data.tar.gz: 11e11cfdece5955686490f861ef20abcfd283d1d2875f5c7212cfabd0bf03aff8589e085e9277b61cd8d0bb71fef6db309617d93134590e574b6817722637d81
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: bug
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Questions or suggestions**
11
+
12
+ We are using [Discussions](https://github.com/libvips/ruby-vips/discussions) for questions and suggestions for new features. Issues are only for bug reports.
13
+
14
+ **Describe the bug**
15
+ A clear and concise description of what the bug is.
16
+
17
+ **To Reproduce**
18
+ Steps to reproduce the behavior:
19
+ 1. Go to '...'
20
+ 2. Click on '....'
21
+ 3. Scroll down to '....'
22
+ 4. See error
23
+
24
+ **Expected behavior**
25
+ A clear and concise description of what you expected to happen.
26
+
27
+ **Screenshots**
28
+ If applicable, add screenshots to help explain your problem.
29
+
30
+ **Desktop (please complete the following information):**
31
+ - OS: [e.g. iOS]
32
+ - Browser [e.g. chrome, safari]
33
+ - Version [e.g. 22]
34
+
35
+ **Smartphone (please complete the following information):**
36
+ - Device: [e.g. iPhone6]
37
+ - OS: [e.g. iOS8.1]
38
+ - Browser [e.g. stock browser, safari]
39
+ - Version [e.g. 22]
40
+
41
+ **Additional context**
42
+ Add any other context about the problem here.
@@ -0,0 +1,54 @@
1
+ name: Development
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+ name: ${{matrix.ruby}} on ${{matrix.os}}
8
+ runs-on: ${{matrix.os}}-latest
9
+ continue-on-error: ${{matrix.experimental}}
10
+
11
+ strategy:
12
+ matrix:
13
+ os:
14
+ - ubuntu
15
+ # - macos
16
+
17
+ ruby:
18
+ - "2.6"
19
+ - "2.7"
20
+ - "3.0"
21
+ - "3.1"
22
+
23
+ experimental: [false]
24
+ env: [""]
25
+
26
+ include:
27
+ - os: ubuntu
28
+ ruby: truffleruby
29
+ experimental: true
30
+ - os: ubuntu
31
+ ruby: jruby
32
+ experimental: true
33
+ - os: ubuntu
34
+ ruby: head
35
+ experimental: true
36
+
37
+ steps:
38
+ - uses: actions/checkout@v2
39
+ - uses: ruby/setup-ruby@v1
40
+ with:
41
+ ruby-version: ${{matrix.ruby}}
42
+ bundler-cache: true
43
+
44
+ - name: Install libvips
45
+ env:
46
+ DEBIAN_FRONTEND: noninteractive
47
+ run: |
48
+ sudo apt-get update -qq -o Acquire::Retries=3
49
+ sudo apt-get install --fix-missing -qq -o Acquire::Retries=3 libvips
50
+ bundle exec rake ext
51
+
52
+ - name: Run tests
53
+ timeout-minutes: 5
54
+ run: ${{matrix.env}} bundle exec rake spec
data/.standard.yml ADDED
@@ -0,0 +1,17 @@
1
+ fix: false # default: false
2
+ parallel: true # default: false
3
+ format: progress # default: Standard::Formatter
4
+ ruby_version: 2.0 # default: RUBY_VERSION
5
+ default_ignores: false # default: true
6
+
7
+ ignore: # default: []
8
+ - '**/*':
9
+ - Standard/SemanticBlocks
10
+ - 'lib/vips/methods.rb'
11
+ - '{lib,example}/**/*':
12
+ - Lint/IneffectiveAccessModifier
13
+ - Lint/RescueException
14
+ - Style/GlobalVars
15
+ - 'spec/**/*':
16
+ - Lint/BinaryOperatorWithIdenticalOperands
17
+ - 'vendor/**/*'
data/.travis.yml CHANGED
@@ -41,6 +41,7 @@ matrix:
41
41
  - rvm: 2.6
42
42
  os: osx
43
43
  env: PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
44
+ - rvm: 2.7
44
45
  - rvm: truffleruby
45
46
  - rvm: jruby-head
46
47
  - rvm: ruby-head
data/.yardopts CHANGED
@@ -1,2 +1 @@
1
- --markup-provider=redcarpet
2
1
  --markup=markdown
data/CHANGELOG.md CHANGED
@@ -2,6 +2,56 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## Version 2.1.4 (2021-10-28)
6
+
7
+ * `write_to_buffer` tries to use the new target API, then falls back to the old
8
+ buffer system [jcupitt]
9
+ * don't generate yard docs for deprecated args [jcupitt]
10
+ * add hyperbolic trig functions [jcupitt]
11
+
12
+ ## Version 2.1.3 (2021-8-23)
13
+
14
+ * fix a gtype size error on win64 [danini-the-panini]
15
+
16
+ ## Version 2.1.2 (2021-5-3)
17
+
18
+ * allow `FFI::Pointer` as an argument to `new_from_memory` etc. [sled]
19
+
20
+ ## Version 2.1.1 (2021-5-3)
21
+
22
+ * fix "mutate" with libvips 8.9 [jcupitt]
23
+ * update autodocs for libvips 8.11 [jcupitt]
24
+
25
+ ## Version 2.1.0 (2021-3-8)
26
+
27
+ * add "mutate" system [jcupitt]
28
+ * better behaviour with some nil parameters [jcupitt]
29
+ * revise gemspec [jcupitt]
30
+ * allow symbols for Interpolate.new [noraj]
31
+ * update docs for 8.10, fix minor doc formatting issues [jcupitt]
32
+ * `new_from_array` checks array argument more carefully [dkam]
33
+ * add `new_from_memory` and `new_from_memory_copy` [ankane]
34
+ * jruby added to CI testing [pftg]
35
+ * switch to github actions for CI [pftg]
36
+ * remove rubocop, revise formatting for standardrb [pftg]
37
+
38
+ ## Version 2.0.17 (2019-10-29)
39
+
40
+ * install msys2 libvips on Windows [larskanis]
41
+ * better `-` to `_` conversion [Nakilon]
42
+ * fix `GValue#set` for stricter metadata rules in 8.9 [jcupitt]
43
+ * fix a ref leak on operation build error [jcupitt]
44
+ * faster operation call [jcupitt]
45
+ * add support for VipsConnection [jcupitt]
46
+ * add `signal_connect` [jcupitt]
47
+ * add `Image#set_kill` for progress termination [jcupitt]
48
+
49
+ ## Version 2.0.16 (2019-9-21)
50
+
51
+ * better library name generation [renchap]
52
+ * allow `_` as a separator in enum names [D-W-L]
53
+ * add `Vips::Region` and `Region#fetch` [jcupitt]
54
+
5
55
  ## Version 2.0.15 (2019-6-12)
6
56
 
7
57
  * better error messages from `write_to_memory` [linkyndy]
data/Gemfile CHANGED
@@ -1,4 +1,11 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # all gems are handled by .gemspec (since this repo is for a gem)
4
4
  gemspec
5
+
6
+ group :maintenance, optional: true do
7
+ gem "bake"
8
+ gem "bake-gem"
9
+ end
10
+
11
+ gem "github-markup"
data/README.md CHANGED
@@ -1,27 +1,26 @@
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)
5
+
3
6
  This gem is a backwards compatible fork of `ruby-vips` but also includes (and compiles) the [libvips] source code.
4
7
 
5
- [![Build Status](https://secure.travis-ci.org/ioquatix/vips.svg)](http://travis-ci.org/ioquatix/vips)
8
+ libvips is a [demand-driven, horizontally
9
+ threaded](https://github.com/libvips/libvips/wiki/Why-is-libvips-quick)
10
+ image processing library. Compared to similar
11
+ libraries, [libvips runs quickly and uses little
12
+ memory](https://github.com/libvips/libvips/wiki/Speed-and-memory-use).
13
+ libvips is licensed under the [LGPL
14
+ 2.1+](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html).
6
15
 
7
- [libvips]: https://jcupitt.github.io/libvips
16
+ [libvips]: https://libvips.github.io/libvips
8
17
 
9
18
  ## Installation
10
19
 
11
- Add this line to your application's Gemfile:
12
-
13
- ```ruby
14
- gem 'vips'
20
+ ``` shell
21
+ $ bundle add vips
15
22
  ```
16
23
 
17
- And then execute:
18
-
19
- $ bundle
20
-
21
- Or install it yourself as:
22
-
23
- $ gem install vips
24
-
25
24
  You'll still need to install `glib` and `gobject-introspection`.
26
25
 
27
26
  ## Usage
@@ -38,7 +37,24 @@ Exactly the same way as [ruby-vips].
38
37
  4. Push to the branch (`git push origin my-new-feature`)
39
38
  5. Create new Pull Request
40
39
 
41
- ## License
40
+ ## Documentation
41
+
42
+ There are [full API docs for ruby-vips on
43
+ rubydoc](https://www.rubydoc.info/gems/ruby-vips). This sometimes has issues
44
+ updating, so we have a [copy on the gh-pages for this site as
45
+ well](http://libvips.github.io/ruby-vips), which
46
+ should always work.
47
+
48
+ See the `Vips` section in the docs for a [tutorial introduction with
49
+ examples](https://www.rubydoc.info/gems/ruby-vips/Vips).
50
+
51
+ The [libvips reference manual](https://libvips.github.io/libvips/API/current/)
52
+ has a complete explanation of every method.
53
+
54
+ The [`example/`](https://github.com/libvips/ruby-vips/tree/master/example)
55
+ directory has some simple example programs.
56
+
57
+ ## Benchmarks
42
58
 
43
59
  Released under the MIT license.
44
60
 
data/Rakefile CHANGED
@@ -1,28 +1,33 @@
1
1
  require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
2
 
4
- RSpec::Core::RakeTask.new(:test)
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ warn e.message
7
+ warn "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
5
10
 
6
- task :default => :test
11
+ require "rake"
7
12
 
8
- task :ext do
9
- Dir.chdir "ext" do
10
- sh "rake"
11
- end
13
+ require "rspec/core"
14
+ require "rspec/core/rake_task"
15
+ RSpec::Core::RakeTask.new(:spec) do |spec|
16
+ spec.pattern = FileList["spec/**/*_spec.rb"]
12
17
  end
13
18
 
14
- task :console do
15
- require 'pry'
16
-
17
- require_relative 'lib/vips'
18
-
19
- Pry.start
19
+ task default: :spec
20
+
21
+ task :ext do
22
+ Dir.chdir "ext" do
23
+ sh "rake"
24
+ end
20
25
  end
21
26
 
22
- require "yard/rake/yardoc_task"
27
+ unless RUBY_PLATFORM.include?("java")
28
+ require "github/markup"
29
+ require "yard"
30
+ require "yard/rake/yardoc_task"
23
31
 
24
- YARD::Rake::YardocTask.new do |yard|
25
- require "yard"
26
- require "github/markup"
27
- require "redcarpet"
32
+ YARD::Rake::YardocTask.new
28
33
  end
data/TODO ADDED
@@ -0,0 +1,43 @@
1
+ # Notes
2
+
3
+ - We should support complex constants, eg:
4
+
5
+ Complex(1, 2)
6
+ => (1+2i)
7
+
8
+ # Common operations
9
+
10
+ - Lint.
11
+
12
+ bundle exec standardrb
13
+
14
+ - Reinstall local copy of gem after a change.
15
+
16
+ bundle exec rake install
17
+
18
+ - Run test suite.
19
+
20
+ bundle exec rake
21
+
22
+ - Version bump.
23
+
24
+ edit lib/vips/version.rb
25
+ edit VERSION
26
+
27
+ - Regenerate autodocs.
28
+
29
+ cd lib/vips
30
+ ruby > methods.rb
31
+ require "vips"; Vips::Yard.generate
32
+ ^D
33
+
34
+ - Regenerate docs.
35
+
36
+ bundle exec rake yard
37
+
38
+ - Push new gem to rubygems, tag repository with version.
39
+
40
+ bundle exec rake release
41
+
42
+ You'll be asked for a otp from authy / google authenticator / etc.
43
+
data/example/annotate.rb CHANGED
@@ -1,17 +1,17 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- require 'vips'
3
+ require "vips"
4
4
 
5
- im = Vips::Image.new_from_file ARGV[0], :access => :sequential
5
+ im = Vips::Image.new_from_file ARGV[0], access: :sequential
6
6
 
7
- left_text = Vips::Image.text "left corner", :dpi => 300
7
+ left_text = Vips::Image.text "left corner", dpi: 300
8
8
  left = left_text.embed 50, 50, im.width, 150
9
9
 
10
- right_text = Vips::Image.text "right corner", :dpi => 300
10
+ right_text = Vips::Image.text "right corner", dpi: 300
11
11
  right = right_text.embed im.width - right_text.width - 50, 50, im.width, 150
12
12
 
13
- footer = (left | right).ifthenelse(0, [255, 0, 0], :blend => true)
13
+ footer = (left | right).ifthenelse(0, [255, 0, 0], blend: true)
14
14
 
15
- im = im.insert footer, 0, im.height, :expand => true
15
+ im = im.insert footer, 0, im.height, expand: true
16
16
 
17
17
  im.write_to_file ARGV[1]
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require "vips"
4
+ require "down/http"
5
+
6
+ # byte_source = File.open ARGV[0], "rb"
7
+ # eg. https://images.unsplash.com/photo-1491933382434-500287f9b54b
8
+ byte_source = Down::Http.open(ARGV[0])
9
+
10
+ source = Vips::SourceCustom.new
11
+ source.on_read do |length|
12
+ puts "reading #{length} bytes ..."
13
+ byte_source.read length
14
+ end
15
+ source.on_seek do |offset, whence|
16
+ puts "seeking to #{offset}, #{whence}"
17
+ byte_source.seek(offset, whence)
18
+ end
19
+
20
+ byte_target = File.open ARGV[1], "wb"
21
+ target = Vips::TargetCustom.new
22
+ target.on_write { |chunk| byte_target.write(chunk) }
23
+ target.on_finish { byte_target.close }
24
+
25
+ image = Vips::Image.new_from_source source, "", access: :sequential
26
+ image.write_to_target target, ".jpg"
@@ -7,7 +7,7 @@
7
7
  # http://libvips.blogspot.co.uk/2013/05/daltonize-in-ruby-vips-carrierwave-and.html
8
8
  # for a discussion of this code
9
9
 
10
- require 'vips'
10
+ require "vips"
11
11
 
12
12
  # Vips.set_debug true
13
13
 
@@ -29,13 +29,13 @@ im = Vips::Image.new_from_file ARGV[0]
29
29
  alpha = nil
30
30
  if im.bands == 4
31
31
  alpha = im[3]
32
- im = im.extract_band 0, :n => 3
32
+ im = im.extract_band 0, n: 3
33
33
  end
34
34
 
35
35
  begin
36
36
  # import to XYZ with lcms
37
37
  # if there's no profile there, we'll fall back to the thing below
38
- xyz = im.icc_import :embedded => true, :pcs => :xyz
38
+ xyz = im.icc_import embedded: true, pcs: :xyz
39
39
  rescue Vips::Error
40
40
  # nope .. use the built-in converter instead
41
41
  xyz = im.colourspace :xyz
@@ -61,9 +61,9 @@ rgb = xyz.colourspace :srgb
61
61
  err = im - rgb
62
62
 
63
63
  # add the error back to other channels to make a compensated image
64
- im = im + err.recomb([[0, 0, 0],
65
- [0.7, 1, 0],
66
- [0.7, 0, 1]])
64
+ im += err.recomb([[0, 0, 0],
65
+ [0.7, 1, 0],
66
+ [0.7, 0, 1]])
67
67
 
68
68
  # reattach any alpha we saved above
69
69
  if alpha
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require "vips"
4
+
5
+ # load and stream into memory
6
+ image = Vips::Image.new_from_file(ARGV[0], access: :sequential).copy_memory
7
+
8
+ starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
9
+
10
+ lines = image
11
+ (0..1).step 0.01 do |i|
12
+ lines = lines.draw_line 255, lines.width * i, 0, 0, lines.height * (1 - i)
13
+ end
14
+
15
+ ending = Process.clock_gettime(Process::CLOCK_MONOTONIC)
16
+ puts "non-destructive took #{ending - starting}s"
17
+
18
+ starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
19
+
20
+ lines = image
21
+ lines = lines.mutate do |x|
22
+ (0..1).step 0.01 do |i|
23
+ x.draw_line! 255, x.width * i, 0, 0, x.height * (1 - i)
24
+ end
25
+ end
26
+
27
+ ending = Process.clock_gettime(Process::CLOCK_MONOTONIC)
28
+ puts "mutate took #{ending - starting}s"
29
+
30
+ lines.write_to_file ARGV[1]
data/example/example1.rb CHANGED
@@ -1,9 +1,9 @@
1
- #!/usr/bin/env ruby
1
+ #!/usr/bin/ruby
2
2
 
3
- require 'logger'
4
- require 'vips'
3
+ require "logger"
4
+ require "vips"
5
5
 
6
- GLib::logger.level = Logger::DEBUG
6
+ GLib.logger.level = Logger::DEBUG
7
7
 
8
8
  Vips::Operation.new "black"
9
9
 
data/example/example2.rb CHANGED
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- require 'logger'
4
- require 'vips'
3
+ require "logger"
4
+ require "vips"
5
5
 
6
6
  puts ""
7
7
  puts "starting up:"
8
8
 
9
9
  # this makes vips keep a list of all active objects which we can print out
10
- Vips::leak_set true
10
+ Vips.leak_set true
11
11
 
12
12
  # disable the operation cache
13
- Vips::cache_set_max 0
13
+ Vips.cache_set_max 0
14
14
 
15
15
  # GLib::logger.level = Logger::DEBUG
16
16
 
@@ -20,7 +20,7 @@ n.times do |i|
20
20
  puts ""
21
21
  puts "call #{i} ..."
22
22
  out = Vips::Operation.call "black", [200, 300]
23
- if out.width != 200 or out.height != 300
23
+ if out.width != 200 || out.height != 300
24
24
  puts "bad image result from black"
25
25
  end
26
26
  end
@@ -28,7 +28,7 @@ end
28
28
  puts ""
29
29
  puts "after #{n} calls:"
30
30
  GC.start
31
- Vips::Object::print_all
31
+ Vips::Object.print_all
32
32
 
33
33
  puts ""
34
34
  puts "shutting down:"
data/example/example3.rb CHANGED
@@ -1,19 +1,19 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- require 'vips'
3
+ require "vips"
4
4
 
5
5
  # this makes vips keep a list of all active objects
6
- Vips::leak_set true
6
+ Vips.leak_set true
7
7
 
8
8
  # disable the operation cache
9
9
  # Vips::cache_set_max 0
10
10
 
11
11
  # turn on debug logging
12
- GLib::logger.level = Logger::DEBUG
12
+ GLib.logger.level = Logger::DEBUG
13
13
 
14
- 1.times do |i|
14
+ 10.times do |i|
15
15
  puts "loop #{i} ..."
16
16
  im = Vips::Image.new_from_file ARGV[0]
17
- im = im.embed 100, 100, 3000, 3000, :extend => :mirror
17
+ im = im.embed 100, 100, 3000, 3000, extend: :mirror
18
18
  im.write_to_file "x.v"
19
19
  end
data/example/example4.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- require 'vips'
3
+ require "vips"
4
4
 
5
5
  # this makes vips keep a list of all active objects
6
- Vips::leak_set true
6
+ Vips.leak_set true
7
7
 
8
8
  # disable the operation cache
9
9
  # Vips::cache_set_max 0
data/example/example5.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
- require 'vips'
3
+ require "vips"
4
4
 
5
5
  # this makes vips keep a list of all active objects
6
6
  # Vips::leak_set true
@@ -15,7 +15,7 @@ if ARGV.length < 2
15
15
  raise "usage: #{$PROGRAM_NAME}: input-file output-file"
16
16
  end
17
17
 
18
- im = Vips::Image.new_from_file ARGV[0], :access => :sequential
18
+ im = Vips::Image.new_from_file ARGV[0], access: :sequential
19
19
 
20
20
  im *= [1, 2, 1]
21
21
 
@@ -23,8 +23,8 @@ im *= [1, 2, 1]
23
23
  # make it ourselves
24
24
  # if you are OK with scale=1, you can just pass the array directly to .conv()
25
25
  mask = Vips::Image.new_from_array [[-1, -1, -1],
26
- [-1, 16, -1],
27
- [-1, -1, -1]], 8
26
+ [-1, 16, -1],
27
+ [-1, -1, -1]], 8
28
28
  im = im.conv mask
29
29
 
30
30
  im.write_to_file ARGV[1]