ruby-vips 2.0.13 → 2.1.0

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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +42 -0
  3. data/.github/workflows/test.yml +80 -0
  4. data/.standard.yml +17 -0
  5. data/.yardopts +0 -1
  6. data/CHANGELOG.md +44 -0
  7. data/Gemfile +3 -1
  8. data/README.md +45 -47
  9. data/Rakefile +13 -15
  10. data/TODO +19 -10
  11. data/VERSION +1 -1
  12. data/example/annotate.rb +7 -7
  13. data/example/connection.rb +26 -0
  14. data/example/daltonize8.rb +27 -29
  15. data/example/draw_lines.rb +30 -0
  16. data/example/example1.rb +5 -6
  17. data/example/example2.rb +11 -11
  18. data/example/example3.rb +9 -9
  19. data/example/example4.rb +8 -8
  20. data/example/example5.rb +8 -9
  21. data/example/inheritance_with_refcount.rb +203 -221
  22. data/example/progress.rb +30 -0
  23. data/example/thumb.rb +12 -14
  24. data/example/trim8.rb +7 -7
  25. data/example/watermark.rb +15 -36
  26. data/example/wobble.rb +25 -25
  27. data/lib/ruby-vips.rb +1 -1
  28. data/lib/vips.rb +473 -338
  29. data/lib/vips/access.rb +9 -9
  30. data/lib/vips/align.rb +7 -8
  31. data/lib/vips/angle.rb +8 -9
  32. data/lib/vips/angle45.rb +12 -13
  33. data/lib/vips/bandformat.rb +16 -18
  34. data/lib/vips/blend_mode.rb +36 -0
  35. data/lib/vips/coding.rb +11 -12
  36. data/lib/vips/compass_direction.rb +13 -14
  37. data/lib/vips/connection.rb +46 -0
  38. data/lib/vips/direction.rb +7 -8
  39. data/lib/vips/extend.rb +13 -14
  40. data/lib/vips/gobject.rb +111 -100
  41. data/lib/vips/gvalue.rb +243 -237
  42. data/lib/vips/image.rb +1501 -1338
  43. data/lib/vips/interesting.rb +10 -11
  44. data/lib/vips/interpolate.rb +50 -54
  45. data/lib/vips/interpretation.rb +25 -26
  46. data/lib/vips/kernel.rb +18 -19
  47. data/lib/vips/methods.rb +929 -309
  48. data/lib/vips/mutableimage.rb +154 -0
  49. data/lib/vips/object.rb +318 -208
  50. data/lib/vips/operation.rb +467 -320
  51. data/lib/vips/operationboolean.rb +10 -11
  52. data/lib/vips/operationcomplex.rb +8 -9
  53. data/lib/vips/operationcomplex2.rb +6 -7
  54. data/lib/vips/operationcomplexget.rb +7 -8
  55. data/lib/vips/operationmath.rb +14 -15
  56. data/lib/vips/operationmath2.rb +6 -7
  57. data/lib/vips/operationrelational.rb +11 -12
  58. data/lib/vips/operationround.rb +7 -8
  59. data/lib/vips/region.rb +73 -0
  60. data/lib/vips/size.rb +9 -10
  61. data/lib/vips/source.rb +88 -0
  62. data/lib/vips/sourcecustom.rb +89 -0
  63. data/lib/vips/target.rb +86 -0
  64. data/lib/vips/targetcustom.rb +77 -0
  65. data/lib/vips/version.rb +1 -2
  66. data/ruby-vips.gemspec +29 -20
  67. metadata +51 -40
  68. data/.travis.yml +0 -55
  69. data/install-vips.sh +0 -26
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e509c29533461f0e4654d1dd116f61b033d589d9f78924bd197cb303fc0d9d0e
4
- data.tar.gz: bf53c311ee52c198b3288e6b11d773dda21403355b3704ecbc4652ce16d51d53
3
+ metadata.gz: b632e0e44fa32da791e46806757e9b6a1a9901d92e2de9b02e16682bc3f3e6b2
4
+ data.tar.gz: 5d3841b9a656d13003b1b2668c05ab89cf5b65c76a52dad070a67b9a6856fe60
5
5
  SHA512:
6
- metadata.gz: 7fcdf3c4f3d66ac3550d17bc45606831a3337a41d8b5af151ff6103bdf0e891036e9ff568930e29f3e045543719801e48ec938310809c4e98af2f4f7ac695031
7
- data.tar.gz: 2ddd68fe1e1f9dcc2174757658d145d5d9777a18c27436758030e376049e956860f6b5d454fe2f1dc1728b17b27cbcf37e1fa3d301edee23a9a7b17f4d0ba874
6
+ metadata.gz: 11c11a729818aa279cf5a157cda6e810174da9089b9ae3a0e92b3c7e6080362dfca5a970b07f3881aa7f31e5aa4acf3cd1a9a05a2e3ef09dc86d7464fe8987fe
7
+ data.tar.gz: 41bae93d0c491699e0042acfe687bc86766af576c9ffe57da1c20a26de548e08c73c0d7685855a155630ed5d47a3a2e2e60f982df48df2a59d4a9f4bd6ccfd34
@@ -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,80 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ pull_request:
8
+ pull_request_target:
9
+ branches:
10
+ - master
11
+
12
+ env:
13
+ NOKOGIRI_USE_SYSTEM_LIBRARIES: true
14
+ SPEC_OPTS: '--backtrace'
15
+
16
+ jobs:
17
+ lint:
18
+ name: Lint
19
+ runs-on: ubuntu-latest
20
+
21
+ steps:
22
+ - name: Checkout code
23
+ uses: actions/checkout@v2
24
+
25
+ - name: Set up Ruby
26
+ uses: ruby/setup-ruby@v1
27
+ with:
28
+ ruby-version: '2.7'
29
+ bundler-cache: true
30
+
31
+ - name: Run standard Ruby linter
32
+ run: bundle exec standardrb --no-fix --fail-fast
33
+
34
+ test:
35
+ name: Functional testing
36
+
37
+ strategy:
38
+ matrix:
39
+ os-version: [ 'ubuntu-20.04' ]
40
+ ruby-version:
41
+ - 2.0
42
+ - 2.1
43
+ - 2.2
44
+ - 2.3
45
+ - 2.4
46
+ - 2.5
47
+ - 2.6
48
+ - 2.7
49
+ - 3.0
50
+ - jruby
51
+ fail-fast: true
52
+
53
+ runs-on: ${{ matrix.os-version }}
54
+
55
+ steps:
56
+ - name: Checkout code
57
+ uses: actions/checkout@v2
58
+
59
+ - name: Set up Ruby
60
+ uses: ruby/setup-ruby@v1
61
+ with:
62
+ ruby-version: ${{ matrix.ruby-version }}
63
+ bundler-cache: true
64
+
65
+ - name: Update apt
66
+ env:
67
+ DEBIAN_FRONTEND: noninteractive
68
+ run:
69
+ sudo apt-get update -qq -o Acquire::Retries=3
70
+
71
+ - name: Install libvips
72
+ env:
73
+ DEBIAN_FRONTEND: noninteractive
74
+ run:
75
+ # we only need the library
76
+ sudo apt-get install --fix-missing -qq -o Acquire::Retries=3
77
+ libvips
78
+
79
+ - name: Run Tests
80
+ run: 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/.yardopts CHANGED
@@ -1,2 +1 @@
1
- --markup-provider=redcarpet
2
1
  --markup=markdown
data/CHANGELOG.md CHANGED
@@ -2,6 +2,50 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## Version 2.1.0 (2021-3-8)
6
+
7
+ * add "mutate" system [jcupitt]
8
+ * better behaviour with some nil parameters [jcupitt]
9
+ * revise gemspec [jcupitt]
10
+ * allow symbols for Interpolate.new [noraj]
11
+ * update docs for 8.10, fix minor doc formatting issues [jcupitt]
12
+ * `new_from_array` checks array argument more carefully [dkam]
13
+ * add `new_from_memory` and `new_from_memory_copy` [ankane]
14
+ * jruby added to CI testing [pftg]
15
+ * switch to github actions for CI [pftg]
16
+ * remove rubocop, revise formatting for standardrb [pftg]
17
+
18
+ ## Version 2.0.17 (2019-10-29)
19
+
20
+ * install msys2 libvips on Windows [larskanis]
21
+ * better `-` to `_` conversion [Nakilon]
22
+ * fix `GValue#set` for stricter metadata rules in 8.9 [jcupitt]
23
+ * fix a ref leak on operation build error [jcupitt]
24
+ * faster operation call [jcupitt]
25
+ * add support for VipsConnection [jcupitt]
26
+ * add `signal_connect` [jcupitt]
27
+ * add `Image#set_kill` for progress termination [jcupitt]
28
+
29
+ ## Version 2.0.16 (2019-9-21)
30
+
31
+ * better library name generation [renchap]
32
+ * allow `_` as a separator in enum names [D-W-L]
33
+ * add `Vips::Region` and `Region#fetch` [jcupitt]
34
+
35
+ ## Version 2.0.15 (2019-6-12)
36
+
37
+ * better error messages from `write_to_memory` [linkyndy]
38
+ * fix doc generation typo for array return [jcupitt]
39
+ * update tests for libvips 8.8 [jcupitt]
40
+
41
+ ## Version 2.0.14 (2018-10-3)
42
+
43
+ * update links for new home [jcupitt]
44
+ * various doc fixes [janko-m]
45
+ * add `Vips::get_suffixes` [jcupitt]
46
+ * prefer options splat [ioquatix]
47
+ * update docs for 8.8 [jcupitt]
48
+
5
49
  ## Version 2.0.13 (2018-8-6)
6
50
 
7
51
  * allow optional args to have `nil` as a value [janko-m]
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
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
+ gem "github-markup"
data/README.md CHANGED
@@ -1,50 +1,27 @@
1
1
  # ruby-vips
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/ruby-vips.svg)](https://badge.fury.io/rb/ruby-vips)
4
- [![Build Status](https://travis-ci.org/jcupitt/ruby-vips.svg?branch=master)](https://travis-ci.org/jcupitt/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
5
 
6
- This gem provides a Ruby binding for the [libvips image processing
7
- library](https://jcupitt.github.io/libvips).
6
+ This gem is a Ruby binding for the [libvips image processing
7
+ library](https://libvips.github.io/libvips).
8
8
 
9
- Programs that use `ruby-vips` don't
10
- manipulate images directly, instead they create pipelines of image processing
11
- operations building on a source image. When the end of the pipe is connected
12
- to a destination, the whole pipeline executes at once, streaming the image
13
- in parallel from source to destination a section at a time.
14
-
15
- Because `ruby-vips` is parallel, it's quick, and because it doesn't need to
16
- keep entire images in memory, it's light. For example, the benchmark at
17
- [vips-benchmarks](https://github.com/jcupitt/vips-benchmarks) loads a
18
- large image, crops, shrinks, sharpens and saves again, and repeats 10 times.
19
-
20
- ```text
21
- real time in seconds, fastest of five runs
22
- benchmark tiff jpeg
23
- ruby-vips.rb 0.85 0.78
24
- image-magick 2.03 2.44
25
- rmagick.rb 3.87 3.89
26
-
27
- peak memory use in kb
28
- benchmark peak RES
29
- ruby-vips.rb 43864
30
- rmagick.rb 788768
31
- ```
32
-
33
- See also [benchmarks at the official libvips
34
- website](https://github.com/jcupitt/libvips/wiki/Speed-and-memory-use).
35
- There's a handy blog post explaining [how libvips opens
36
- files](http://libvips.blogspot.co.uk/2012/06/how-libvips-opens-file.html)
37
- which gives some more background.
9
+ Programs that use `ruby-vips` don't manipulate images directly, instead
10
+ they create pipelines of image processing operations building on a source
11
+ image. When the end of the pipe is connected to a destination, the whole
12
+ pipeline executes at once, streaming the image in parallel from source to
13
+ destination a section at a time. Because `ruby-vips` is parallel, it's quick,
14
+ and because it doesn't need to keep entire images in memory, it's light.
38
15
 
39
16
  ## Requirements
40
17
 
41
18
  * macOS, Linux, and Windows tested
42
19
 
43
- * libvips 8.2 or later, see the [libvips install instructions](https://jcupitt.github.io/libvips/install.html)
20
+ * libvips 8.2 or later, see the [libvips install instructions](https://libvips.github.io/libvips/install.html)
44
21
 
45
22
  * [ruby-ffi](https://github.com/ffi/ffi) 1.9 or later
46
23
 
47
- * Ruby 2.0+, JRuby should work
24
+ * Ruby 2.0+, JRuby
48
25
 
49
26
  ## Install
50
27
 
@@ -57,26 +34,23 @@ $ gem install ruby-vips
57
34
  or include it in `Gemfile`:
58
35
 
59
36
  ```ruby
60
- gem 'ruby-vips'
37
+ gem "ruby-vips"
61
38
  ```
62
39
 
63
40
  On Windows, you'll need to set the `RUBY_DLL_PATH` environment variable to
64
41
  point to the libvips bin directory.
65
42
 
66
- Take a look in `examples/`. There is [full API
67
- documentation](http://www.rubydoc.info/gems/ruby-vips).
68
-
69
43
  # Example
70
44
 
71
45
  ```ruby
72
- require 'vips'
46
+ require "vips"
73
47
 
74
48
  im = Vips::Image.new_from_file filename
75
49
 
76
50
  # put im at position (100, 100) in a 3000 x 3000 pixel image,
77
51
  # make the other pixels in the image by mirroring im up / down /
78
52
  # left / right, see
79
- # https://jcupitt.github.io/libvips/API/current/libvips-conversion.html#vips-embed
53
+ # https://libvips.github.io/libvips/API/current/libvips-conversion.html#vips-embed
80
54
  im = im.embed 100, 100, 3000, 3000, extend: :mirror
81
55
 
82
56
  # multiply the green (middle) band by 2, leave the other two alone
@@ -93,13 +67,37 @@ im = im.conv mask, precision: :integer
93
67
  im.write_to_file output_filename
94
68
  ```
95
69
 
96
- # Older versions
70
+ The `Vips` section in the API docs has a [tutorial introduction with
71
+ examples](https://www.rubydoc.info/gems/ruby-vips/Vips).
97
72
 
98
- There are two older versions of this gem.
73
+ ruby-vips has [API
74
+ documentation](http://www.rubydoc.info/gems/ruby-vips). The [libvips
75
+ reference manual](https://libvips.github.io/libvips/API/current/) has a
76
+ complete explanation of every method.
99
77
 
100
- The `0.3-stable` branch is written in C and supports a different API. It still
101
- works, but is only maintained for compatibility.
78
+ The
79
+ [`example/`](https://github.com/libvips/ruby-vips/tree/master/example)
80
+ directory has some simple example programs.
81
+
82
+ # Benchmarks
83
+
84
+ The benchmark at [vips-benchmarks](https://github.com/jcupitt/vips-benchmarks)
85
+ loads a large image, crops, shrinks, sharpens and saves again, and repeats
86
+ 10 times.
87
+
88
+ ```text
89
+ real time in seconds, fastest of five runs
90
+ benchmark tiff jpeg
91
+ ruby-vips.rb 0.85 0.78
92
+ image-magick 2.03 2.44
93
+ rmagick.rb 3.87 3.89
94
+
95
+ peak memory use in kb
96
+ benchmark peak RES
97
+ ruby-vips.rb 43864
98
+ rmagick.rb 788768
99
+ ```
100
+
101
+ See also [benchmarks at the official libvips
102
+ website](https://github.com/libvips/libvips/wiki/Speed-and-memory-use).
102
103
 
103
- The `1.0-stable` branch is based on `gobject-introspection` rather than
104
- `ffi`. It supports the same API as the current version, but is harder to
105
- install, less portable, slower, and less stable.
data/Rakefile CHANGED
@@ -1,29 +1,27 @@
1
- # encoding: utf-8
2
-
3
- require 'bundler/gem_tasks'
1
+ require "bundler/gem_tasks"
4
2
 
5
3
  begin
6
4
  Bundler.setup(:default, :development)
7
5
  rescue Bundler::BundlerError => e
8
- $stderr.puts e.message
9
- $stderr.puts "Run `bundle install` to install missing gems"
6
+ warn e.message
7
+ warn "Run `bundle install` to install missing gems"
10
8
  exit e.status_code
11
9
  end
12
10
 
13
- require 'rake'
11
+ require "rake"
14
12
 
15
- require 'rspec/core'
16
- require 'rspec/core/rake_task'
13
+ require "rspec/core"
14
+ require "rspec/core/rake_task"
17
15
  RSpec::Core::RakeTask.new(:spec) do |spec|
18
- spec.pattern = FileList['spec/**/*_spec.rb']
16
+ spec.pattern = FileList["spec/**/*_spec.rb"]
19
17
  end
20
18
 
21
- task :default => :spec
19
+ task default: :spec
22
20
 
23
- require "github/markup"
24
- require "redcarpet"
25
- require "yard"
26
- require "yard/rake/yardoc_task"
21
+ unless RUBY_PLATFORM.include?("java")
22
+ require "github/markup"
23
+ require "yard"
24
+ require "yard/rake/yardoc_task"
27
25
 
28
- YARD::Rake::YardocTask.new do |yard|
26
+ YARD::Rake::YardocTask.new
29
27
  end
data/TODO CHANGED
@@ -1,36 +1,45 @@
1
1
  # Notes
2
2
 
3
- - support complex constants, eg.
3
+ - We should support complex constants, eg:
4
4
 
5
5
  Complex(1, 2)
6
6
  => (1+2i)
7
7
 
8
8
  # Common operations
9
9
 
10
- - version bump
10
+ - Lint.
11
11
 
12
- edit lib/vips/version.rb
13
- edit VERSION
12
+ bundle exec standardrb
14
13
 
15
- - reinstall local copy of gem after a change
14
+ - Reinstall local copy of gem after a change.
16
15
 
17
16
  bundle exec rake install
18
17
 
19
- - run test suite
18
+ - Run test suite.
20
19
 
21
20
  bundle exec rake
22
21
 
23
- - regenerate autodocs
22
+ - Version bump.
23
+
24
+ edit lib/vips/version.rb
25
+ edit VERSION
26
+
27
+ - Regenerate autodocs.
24
28
 
25
29
  cd lib/vips
26
30
  ruby > methods.rb
27
- require 'vips'; Vips::generate_yard
31
+ require "vips"; Vips::Yard.generate
28
32
  ^D
29
33
 
30
- - regenerate docs
34
+ - Regenerate docs.
31
35
 
32
36
  bundle exec rake yard
33
37
 
34
- - push new gem to rubygems, tag repository with version
38
+ - Push new gem to rubygems, tag repository with version.
35
39
 
40
+ gem2.5 signin --otp 111111 / enter username and passwd
36
41
  bundle exec rake release
42
+
43
+ There's an invisible prompt for the authenticator code. Enter eg. 123456,
44
+ press return and the upload should work.
45
+