ruby-vips 2.0.15 → 2.1.2
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 +39 -0
- data/Gemfile +3 -1
- data/README.md +42 -41
- data/Rakefile +13 -21
- data/TODO +14 -14
- data/VERSION +1 -1
- data/example/annotate.rb +6 -6
- data/example/connection.rb +26 -0
- data/example/daltonize8.rb +6 -6
- data/example/draw_lines.rb +30 -0
- data/example/example1.rb +4 -4
- data/example/example2.rb +6 -6
- data/example/example3.rb +5 -5
- data/example/example4.rb +2 -2
- data/example/example5.rb +4 -4
- data/example/inheritance_with_refcount.rb +35 -36
- data/example/progress.rb +30 -0
- data/example/thumb.rb +6 -6
- data/example/trim8.rb +1 -1
- data/example/watermark.rb +2 -2
- data/example/wobble.rb +1 -1
- data/lib/ruby-vips.rb +1 -1
- data/lib/vips.rb +191 -79
- data/lib/vips/blend_mode.rb +29 -25
- data/lib/vips/connection.rb +46 -0
- data/lib/vips/gobject.rb +27 -12
- data/lib/vips/gvalue.rb +62 -50
- data/lib/vips/image.rb +475 -256
- data/lib/vips/interpolate.rb +3 -2
- data/lib/vips/methods.rb +788 -121
- data/lib/vips/mutableimage.rb +173 -0
- data/lib/vips/object.rb +171 -54
- data/lib/vips/operation.rb +272 -117
- data/lib/vips/region.rb +73 -0
- 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 -1
- data/ruby-vips.gemspec +26 -20
- metadata +39 -50
- data/.rubocop.yml +0 -22
- data/.rubocop_todo.yml +0 -515
- 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: 267111867f885404762f693512589879bf5f1a47ef0711e368aa6bf57acdb78d
|
4
|
+
data.tar.gz: 80b65db37293a9054f508a786f841fbce6f5638cd9e237cba68074cdf3455420
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62c7552e7372e35005cc2212d05471c30194511a06065c658aca6b63b5a1bdfe7b3fecece9231b533d274956981bc65e61c7fc5d4d3bc64268e723f10425c80c
|
7
|
+
data.tar.gz: a908583f08ed891280aaf94aa57275b04038b831027954298f7a8cb98e85c90bc3f61fb276e89f159bb874404022b015b3144e899f6c41170ed9ae082bc97903
|
@@ -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,45 @@
|
|
2
2
|
|
3
3
|
## master
|
4
4
|
|
5
|
+
## Version 2.1.2 (2021-5-3)
|
6
|
+
|
7
|
+
* allow `FFI::Pointer` as an argument to `new_from_memory` etc. [sled]
|
8
|
+
|
9
|
+
## Version 2.1.1 (2021-5-3)
|
10
|
+
|
11
|
+
* fix "mutate" with libvips 8.9 [jcupitt]
|
12
|
+
* update autodocs for libvips 8.11 [jcupitt]
|
13
|
+
|
14
|
+
## Version 2.1.0 (2021-3-8)
|
15
|
+
|
16
|
+
* add "mutate" system [jcupitt]
|
17
|
+
* better behaviour with some nil parameters [jcupitt]
|
18
|
+
* revise gemspec [jcupitt]
|
19
|
+
* allow symbols for Interpolate.new [noraj]
|
20
|
+
* update docs for 8.10, fix minor doc formatting issues [jcupitt]
|
21
|
+
* `new_from_array` checks array argument more carefully [dkam]
|
22
|
+
* add `new_from_memory` and `new_from_memory_copy` [ankane]
|
23
|
+
* jruby added to CI testing [pftg]
|
24
|
+
* switch to github actions for CI [pftg]
|
25
|
+
* remove rubocop, revise formatting for standardrb [pftg]
|
26
|
+
|
27
|
+
## Version 2.0.17 (2019-10-29)
|
28
|
+
|
29
|
+
* install msys2 libvips on Windows [larskanis]
|
30
|
+
* better `-` to `_` conversion [Nakilon]
|
31
|
+
* fix `GValue#set` for stricter metadata rules in 8.9 [jcupitt]
|
32
|
+
* fix a ref leak on operation build error [jcupitt]
|
33
|
+
* faster operation call [jcupitt]
|
34
|
+
* add support for VipsConnection [jcupitt]
|
35
|
+
* add `signal_connect` [jcupitt]
|
36
|
+
* add `Image#set_kill` for progress termination [jcupitt]
|
37
|
+
|
38
|
+
## Version 2.0.16 (2019-9-21)
|
39
|
+
|
40
|
+
* better library name generation [renchap]
|
41
|
+
* allow `_` as a separator in enum names [D-W-L]
|
42
|
+
* add `Vips::Region` and `Region#fetch` [jcupitt]
|
43
|
+
|
5
44
|
## Version 2.0.15 (2019-6-12)
|
6
45
|
|
7
46
|
* better error messages from `write_to_memory` [linkyndy]
|
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,44 +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
|
-
bundle exec
|
12
|
+
bundle exec standardrb
|
13
13
|
|
14
|
-
-
|
14
|
+
- Reinstall local copy of gem after a change.
|
15
15
|
|
16
16
|
bundle exec rake install
|
17
17
|
|
18
|
-
-
|
18
|
+
- Run test suite.
|
19
19
|
|
20
20
|
bundle exec rake
|
21
21
|
|
22
|
-
-
|
22
|
+
- Version bump.
|
23
23
|
|
24
24
|
edit lib/vips/version.rb
|
25
25
|
edit VERSION
|
26
26
|
|
27
|
-
-
|
27
|
+
- Regenerate autodocs.
|
28
28
|
|
29
29
|
cd lib/vips
|
30
30
|
ruby > methods.rb
|
31
|
-
require
|
31
|
+
require "vips"; Vips::Yard.generate
|
32
32
|
^D
|
33
33
|
|
34
|
-
-
|
35
|
-
|
36
|
-
bundle exec rubocop --auto-gen-config
|
37
|
-
|
38
|
-
- regenerate docs
|
34
|
+
- Regenerate docs.
|
39
35
|
|
40
36
|
bundle exec rake yard
|
41
37
|
|
42
|
-
-
|
38
|
+
- Push new gem to rubygems, tag repository with version.
|
43
39
|
|
40
|
+
gem signin --otp 111111
|
44
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.2
|