ruby-vips 2.0.14 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +42 -0
- data/.github/workflows/test.yml +80 -0
- data/.standard.yml +17 -0
- data/.yardopts +0 -1
- data/CHANGELOG.md +41 -0
- data/Gemfile +3 -1
- data/README.md +42 -41
- data/Rakefile +13 -21
- data/TODO +18 -10
- data/VERSION +1 -1
- data/example/annotate.rb +6 -6
- data/example/connection.rb +26 -0
- data/example/daltonize8.rb +16 -18
- data/example/draw_lines.rb +30 -0
- data/example/example1.rb +5 -6
- data/example/example2.rb +6 -6
- data/example/example3.rb +5 -5
- data/example/example4.rb +4 -4
- data/example/example5.rb +6 -7
- data/example/inheritance_with_refcount.rb +36 -54
- data/example/progress.rb +30 -0
- data/example/thumb.rb +8 -10
- data/example/trim8.rb +5 -5
- data/example/watermark.rb +2 -2
- data/example/wobble.rb +1 -1
- data/lib/ruby-vips.rb +1 -1
- data/lib/vips.rb +199 -93
- data/lib/vips/align.rb +0 -1
- data/lib/vips/angle.rb +0 -1
- data/lib/vips/angle45.rb +0 -1
- data/lib/vips/bandformat.rb +0 -2
- data/lib/vips/blend_mode.rb +29 -27
- data/lib/vips/coding.rb +0 -1
- data/lib/vips/compass_direction.rb +0 -1
- data/lib/vips/connection.rb +46 -0
- data/lib/vips/direction.rb +0 -1
- data/lib/vips/extend.rb +0 -1
- data/lib/vips/gobject.rb +26 -15
- data/lib/vips/gvalue.rb +61 -55
- data/lib/vips/image.rb +455 -282
- data/lib/vips/interesting.rb +0 -1
- data/lib/vips/interpolate.rb +3 -7
- data/lib/vips/interpretation.rb +0 -1
- data/lib/vips/kernel.rb +0 -1
- data/lib/vips/methods.rb +791 -124
- data/lib/vips/mutableimage.rb +173 -0
- data/lib/vips/object.rb +178 -68
- data/lib/vips/operation.rb +277 -130
- data/lib/vips/operationboolean.rb +0 -1
- data/lib/vips/operationcomplex.rb +0 -1
- data/lib/vips/operationcomplex2.rb +0 -1
- data/lib/vips/operationcomplexget.rb +0 -1
- data/lib/vips/operationmath.rb +0 -1
- data/lib/vips/operationmath2.rb +0 -1
- data/lib/vips/operationrelational.rb +0 -1
- data/lib/vips/operationround.rb +0 -1
- data/lib/vips/region.rb +73 -0
- data/lib/vips/size.rb +0 -1
- data/lib/vips/source.rb +88 -0
- data/lib/vips/sourcecustom.rb +89 -0
- data/lib/vips/target.rb +86 -0
- data/lib/vips/targetcustom.rb +77 -0
- data/lib/vips/version.rb +1 -2
- data/ruby-vips.gemspec +26 -21
- metadata +39 -51
- data/.rubocop.yml +0 -10
- data/.rubocop_todo.yml +0 -730
- data/.travis.yml +0 -62
- data/install-vips.sh +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c77f69e33910d95f8f678cff9787066e2af91cd889f24ec3834dcfaf78ee5cfc
|
4
|
+
data.tar.gz: 140effde4d987fff3e293034b0967245aa4f914ba603d8bce41010d0ec1a63ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28b7309c3a0744b29c5d100b898aab3521cc07a17667d4041db3d5194db537336bdda578e25fddb79be929c0ac32a246fb47f08862c5273fc94c2e390cc5874c
|
7
|
+
data.tar.gz: d428e645d302329a9544819a188b7b010f1e265086a064cd2480dc5213d61a9ef78b0da5381a6f8bd85754ac5c8f2ce6f253701afb27e3180e157d1e807294d3
|
@@ -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
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,47 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## Version 2.1.1 (2021-5-3)
|
6
|
+
|
7
|
+
* fix "mutate" with libvips 8.9 [jcupitt]
|
8
|
+
* update autodocs for libvips 8.11 [jcupitt]
|
9
|
+
|
10
|
+
## Version 2.1.0 (2021-3-8)
|
11
|
+
|
12
|
+
* add "mutate" system [jcupitt]
|
13
|
+
* better behaviour with some nil parameters [jcupitt]
|
14
|
+
* revise gemspec [jcupitt]
|
15
|
+
* allow symbols for Interpolate.new [noraj]
|
16
|
+
* update docs for 8.10, fix minor doc formatting issues [jcupitt]
|
17
|
+
* `new_from_array` checks array argument more carefully [dkam]
|
18
|
+
* add `new_from_memory` and `new_from_memory_copy` [ankane]
|
19
|
+
* jruby added to CI testing [pftg]
|
20
|
+
* switch to github actions for CI [pftg]
|
21
|
+
* remove rubocop, revise formatting for standardrb [pftg]
|
22
|
+
|
23
|
+
## Version 2.0.17 (2019-10-29)
|
24
|
+
|
25
|
+
* install msys2 libvips on Windows [larskanis]
|
26
|
+
* better `-` to `_` conversion [Nakilon]
|
27
|
+
* fix `GValue#set` for stricter metadata rules in 8.9 [jcupitt]
|
28
|
+
* fix a ref leak on operation build error [jcupitt]
|
29
|
+
* faster operation call [jcupitt]
|
30
|
+
* add support for VipsConnection [jcupitt]
|
31
|
+
* add `signal_connect` [jcupitt]
|
32
|
+
* add `Image#set_kill` for progress termination [jcupitt]
|
33
|
+
|
34
|
+
## Version 2.0.16 (2019-9-21)
|
35
|
+
|
36
|
+
* better library name generation [renchap]
|
37
|
+
* allow `_` as a separator in enum names [D-W-L]
|
38
|
+
* add `Vips::Region` and `Region#fetch` [jcupitt]
|
39
|
+
|
40
|
+
## Version 2.0.15 (2019-6-12)
|
41
|
+
|
42
|
+
* better error messages from `write_to_memory` [linkyndy]
|
43
|
+
* fix doc generation typo for array return [jcupitt]
|
44
|
+
* update tests for libvips 8.8 [jcupitt]
|
45
|
+
|
5
46
|
## Version 2.0.14 (2018-10-3)
|
6
47
|
|
7
48
|
* update links for new home [jcupitt]
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,37 +1,17 @@
|
|
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
|
-
[![
|
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
|
6
|
+
This gem is a Ruby binding for the [libvips image processing
|
7
7
|
library](https://libvips.github.io/libvips).
|
8
8
|
|
9
|
-
Programs that use `ruby-vips` don't
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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/libvips/libvips/wiki/Speed-and-memory-use).
|
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.
|
35
15
|
|
36
16
|
## Requirements
|
37
17
|
|
@@ -41,7 +21,7 @@ website](https://github.com/libvips/libvips/wiki/Speed-and-memory-use).
|
|
41
21
|
|
42
22
|
* [ruby-ffi](https://github.com/ffi/ffi) 1.9 or later
|
43
23
|
|
44
|
-
* Ruby 2.0+, JRuby
|
24
|
+
* Ruby 2.0+, JRuby
|
45
25
|
|
46
26
|
## Install
|
47
27
|
|
@@ -54,19 +34,16 @@ $ gem install ruby-vips
|
|
54
34
|
or include it in `Gemfile`:
|
55
35
|
|
56
36
|
```ruby
|
57
|
-
gem
|
37
|
+
gem "ruby-vips"
|
58
38
|
```
|
59
39
|
|
60
40
|
On Windows, you'll need to set the `RUBY_DLL_PATH` environment variable to
|
61
41
|
point to the libvips bin directory.
|
62
42
|
|
63
|
-
Take a look in `examples/`. There is [full API
|
64
|
-
documentation](http://www.rubydoc.info/gems/ruby-vips).
|
65
|
-
|
66
43
|
# Example
|
67
44
|
|
68
45
|
```ruby
|
69
|
-
require
|
46
|
+
require "vips"
|
70
47
|
|
71
48
|
im = Vips::Image.new_from_file filename
|
72
49
|
|
@@ -90,13 +67,37 @@ im = im.conv mask, precision: :integer
|
|
90
67
|
im.write_to_file output_filename
|
91
68
|
```
|
92
69
|
|
93
|
-
|
70
|
+
The `Vips` section in the API docs has a [tutorial introduction with
|
71
|
+
examples](https://www.rubydoc.info/gems/ruby-vips/Vips).
|
94
72
|
|
95
|
-
|
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.
|
96
77
|
|
97
|
-
The
|
98
|
-
|
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).
|
99
103
|
|
100
|
-
The `1.0-stable` branch is based on `gobject-introspection` rather than
|
101
|
-
`ffi`. It supports the same API as the current version, but is harder to
|
102
|
-
install, less portable, slower, and less stable.
|
data/Rakefile
CHANGED
@@ -1,35 +1,27 @@
|
|
1
|
-
|
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
|
-
|
9
|
-
|
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
|
11
|
+
require "rake"
|
14
12
|
|
15
|
-
require
|
16
|
-
require
|
13
|
+
require "rspec/core"
|
14
|
+
require "rspec/core/rake_task"
|
17
15
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
18
|
-
spec.pattern = FileList[
|
16
|
+
spec.pattern = FileList["spec/**/*_spec.rb"]
|
19
17
|
end
|
20
18
|
|
21
|
-
task :
|
22
|
-
|
23
|
-
require "github/markup"
|
24
|
-
require "redcarpet"
|
25
|
-
require "yard"
|
26
|
-
require "yard/rake/yardoc_task"
|
19
|
+
task default: :spec
|
27
20
|
|
28
|
-
|
29
|
-
|
21
|
+
unless RUBY_PLATFORM.include?("java")
|
22
|
+
require "github/markup"
|
23
|
+
require "yard"
|
24
|
+
require "yard/rake/yardoc_task"
|
30
25
|
|
31
|
-
|
32
|
-
if Gem.ruby_version >= Gem::Version.new("2.2.0")
|
33
|
-
require 'rubocop/rake_task'
|
34
|
-
RuboCop::RakeTask.new
|
26
|
+
YARD::Rake::YardocTask.new
|
35
27
|
end
|
data/TODO
CHANGED
@@ -1,36 +1,44 @@
|
|
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
|
-
-
|
10
|
+
- Lint.
|
11
11
|
|
12
|
-
|
13
|
-
edit VERSION
|
12
|
+
bundle exec standardrb
|
14
13
|
|
15
|
-
-
|
14
|
+
- Reinstall local copy of gem after a change.
|
16
15
|
|
17
16
|
bundle exec rake install
|
18
17
|
|
19
|
-
-
|
18
|
+
- Run test suite.
|
20
19
|
|
21
20
|
bundle exec rake
|
22
21
|
|
23
|
-
-
|
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
|
31
|
+
require "vips"; Vips::Yard.generate
|
28
32
|
^D
|
29
33
|
|
30
|
-
-
|
34
|
+
- Regenerate docs.
|
31
35
|
|
32
36
|
bundle exec rake yard
|
33
37
|
|
34
|
-
-
|
38
|
+
- Push new gem to rubygems, tag repository with version.
|
35
39
|
|
40
|
+
gem signin --otp 111111
|
36
41
|
bundle exec rake release
|
42
|
+
|
43
|
+
The otp is from authy / google authenticator / etc.
|
44
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.1.1
|