ruby-vips 0.3.14 → 1.0.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.
- checksums.yaml +4 -4
- data/.travis.yml +22 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +46 -31
- data/{LICENSE → LICENSE.txt} +1 -1
- data/README.md +101 -145
- data/Rakefile +45 -0
- data/TODO +8 -32
- data/VERSION +1 -0
- data/example/annotate.rb +17 -0
- data/example/daltonize8.rb +75 -0
- data/example/example1.rb +84 -0
- data/example/example2.rb +31 -0
- data/example/example3.rb +19 -0
- data/example/example4.rb +18 -0
- data/example/example5.rb +31 -0
- data/example/trim8.rb +41 -0
- data/example/watermark.rb +44 -0
- data/example/wobble.rb +36 -0
- data/lib/vips.rb +151 -14
- data/lib/vips/access.rb +14 -0
- data/lib/vips/align.rb +11 -0
- data/lib/vips/angle.rb +12 -0
- data/lib/vips/angle45.rb +16 -0
- data/lib/vips/argument.rb +163 -0
- data/lib/vips/bandformat.rb +20 -0
- data/lib/vips/call.rb +302 -0
- data/lib/vips/coding.rb +14 -0
- data/lib/vips/demandstyle.rb +35 -0
- data/lib/vips/direction.rb +11 -0
- data/lib/vips/error.rb +30 -0
- data/lib/vips/extend.rb +22 -0
- data/lib/vips/foreignflags.rb +20 -0
- data/lib/vips/image.rb +1382 -0
- data/lib/vips/interpolate.rb +37 -0
- data/lib/vips/interpretation.rb +28 -0
- data/lib/vips/methods.rb +1807 -0
- data/lib/vips/operation.rb +19 -0
- data/ruby-vips8.gemspec +112 -0
- data/spec/image_spec.rb +515 -0
- data/spec/samples/balloon.v +0 -0
- data/spec/samples/ghost.ppm +405 -0
- data/spec/samples/huge.jpg +0 -0
- data/spec/samples/icc.jpg +0 -0
- data/spec/samples/lcd.icc +0 -0
- data/spec/samples/lion.svg +154 -0
- data/spec/samples/sample.csv +7 -0
- data/spec/samples/sample.exr +0 -0
- data/spec/samples/wagon.jpg +0 -0
- data/spec/samples/wagon.v +0 -0
- data/spec/spec_helper.rb +49 -0
- data/spec/vips_spec.rb +74 -0
- metadata +110 -70
- data/ext/extconf.rb +0 -31
- data/ext/header.c +0 -457
- data/ext/header.h +0 -9
- data/ext/image.c +0 -629
- data/ext/image.h +0 -72
- data/ext/image_arithmetic.c +0 -936
- data/ext/image_arithmetic.h +0 -38
- data/ext/image_boolean.c +0 -301
- data/ext/image_boolean.h +0 -8
- data/ext/image_colour.c +0 -590
- data/ext/image_colour.h +0 -36
- data/ext/image_conversion.c +0 -884
- data/ext/image_conversion.h +0 -38
- data/ext/image_convolution.c +0 -368
- data/ext/image_convolution.h +0 -13
- data/ext/image_freq_filt.c +0 -740
- data/ext/image_freq_filt.h +0 -27
- data/ext/image_histograms_lut.c +0 -643
- data/ext/image_histograms_lut.h +0 -28
- data/ext/image_morphology.c +0 -327
- data/ext/image_morphology.h +0 -13
- data/ext/image_mosaicing.c +0 -554
- data/ext/image_mosaicing.h +0 -15
- data/ext/image_relational.c +0 -384
- data/ext/image_relational.h +0 -8
- data/ext/image_resample.c +0 -249
- data/ext/image_resample.h +0 -9
- data/ext/interpolator.c +0 -106
- data/ext/interpolator.h +0 -7
- data/ext/mask.c +0 -347
- data/ext/mask.h +0 -18
- data/ext/reader.c +0 -261
- data/ext/reader.h +0 -2
- data/ext/ruby_vips.c +0 -188
- data/ext/ruby_vips.h +0 -72
- data/ext/tags +0 -450
- data/ext/writer.c +0 -371
- data/ext/writer.h +0 -2
- data/lib/vips/reader.rb +0 -272
- data/lib/vips/version.rb +0 -3
- data/lib/vips/writer.rb +0 -342
- data/ruby-vips.gemspec +0 -100
- data/ruby.supp +0 -134
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a944b8cabe34780ee544fb8504a6618efd94c674
|
4
|
+
data.tar.gz: b5740fa6840ce9905fa30870a6100b49b9adc1f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1b926ab064590c3f67ce2f346af93696d413c05787e56263ef1d46ef89d8a16f0f705c9edd6d85e1560a660cbae644f456eab17c4f8df81da2844781b221438
|
7
|
+
data.tar.gz: 3c337597296afec5e3464fd12052823780a0cde94774dbc2bb39cc289be21230604d3774d72d85fc2498d9acb1ac7e17c7ebca4567b7d1a961b36829e30eb757
|
data/.travis.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
env:
|
2
|
+
global:
|
3
|
+
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
4
|
+
|
5
|
+
sudo: false
|
6
|
+
cache: bundler
|
7
|
+
|
8
|
+
language: ruby
|
9
|
+
rvm:
|
10
|
+
- 1.9.3
|
11
|
+
- 2.0
|
12
|
+
- 2.1
|
13
|
+
|
14
|
+
script: "rake"
|
15
|
+
|
16
|
+
gemfile:
|
17
|
+
- Gemfile
|
18
|
+
|
19
|
+
before_install:
|
20
|
+
- uname -a
|
21
|
+
- apt-get update
|
22
|
+
- apt-get install libvips-dev
|
data/CHANGELOG.md
CHANGED
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
# runtime deps
|
4
|
+
gem "gobject-introspection", "~> 3.0"
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development do
|
9
|
+
gem "rspec", "~> 3.3"
|
10
|
+
gem "yard", "~> 0.8"
|
11
|
+
gem "redcarpet", "~> 3.3"
|
12
|
+
gem "github-markup", "~> 1.4"
|
13
|
+
gem "bundler", "~> 1.0"
|
14
|
+
gem "jeweler", "~> 2.0"
|
15
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,51 +1,60 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
addressable (2.
|
4
|
+
addressable (2.4.0)
|
5
5
|
builder (3.2.2)
|
6
|
+
descendants_tracker (0.0.4)
|
7
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
6
8
|
diff-lcs (1.2.5)
|
7
|
-
faraday (0.
|
8
|
-
multipart-post (
|
9
|
-
git (1.
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
9
|
+
faraday (0.9.2)
|
10
|
+
multipart-post (>= 1.2, < 3)
|
11
|
+
git (1.3.0)
|
12
|
+
github-markup (1.4.0)
|
13
|
+
github_api (0.14.0)
|
14
|
+
addressable (~> 2.4.0)
|
15
|
+
descendants_tracker (~> 0.0.4)
|
16
|
+
faraday (~> 0.8, < 0.10)
|
17
|
+
hashie (>= 3.4)
|
16
18
|
oauth2
|
17
|
-
|
18
|
-
|
19
|
-
|
19
|
+
glib2 (3.0.8)
|
20
|
+
pkg-config
|
21
|
+
gobject-introspection (3.0.8)
|
22
|
+
glib2 (= 3.0.8)
|
23
|
+
hashie (3.4.4)
|
24
|
+
highline (1.7.8)
|
25
|
+
jeweler (2.1.1)
|
20
26
|
builder
|
21
|
-
bundler (
|
27
|
+
bundler (>= 1.0)
|
22
28
|
git (>= 1.2.5)
|
23
|
-
github_api
|
29
|
+
github_api
|
24
30
|
highline (>= 1.6.15)
|
25
|
-
nokogiri (
|
31
|
+
nokogiri (>= 1.5.10)
|
26
32
|
rake
|
27
33
|
rdoc
|
34
|
+
semver
|
28
35
|
json (1.8.3)
|
29
|
-
jwt (1.
|
30
|
-
multi_json (1.
|
36
|
+
jwt (1.5.1)
|
37
|
+
multi_json (1.12.1)
|
31
38
|
multi_xml (0.5.5)
|
32
|
-
multipart-post (
|
33
|
-
nokogiri (1.
|
34
|
-
oauth2 (1.
|
39
|
+
multipart-post (2.0.0)
|
40
|
+
nokogiri (1.6.7.2)
|
41
|
+
oauth2 (1.1.0)
|
35
42
|
faraday (>= 0.8, < 0.10)
|
36
|
-
jwt (~> 1.0)
|
43
|
+
jwt (~> 1.0, < 1.5.2)
|
37
44
|
multi_json (~> 1.3)
|
38
45
|
multi_xml (~> 0.5)
|
39
|
-
rack (
|
40
|
-
|
41
|
-
|
42
|
-
|
46
|
+
rack (>= 1.2, < 3)
|
47
|
+
pkg-config (1.1.7)
|
48
|
+
rack (1.6.4)
|
49
|
+
rake (11.1.2)
|
50
|
+
rdoc (4.2.2)
|
43
51
|
json (~> 1.4)
|
52
|
+
redcarpet (3.3.4)
|
44
53
|
rspec (3.4.0)
|
45
54
|
rspec-core (~> 3.4.0)
|
46
55
|
rspec-expectations (~> 3.4.0)
|
47
56
|
rspec-mocks (~> 3.4.0)
|
48
|
-
rspec-core (3.4.
|
57
|
+
rspec-core (3.4.4)
|
49
58
|
rspec-support (~> 3.4.0)
|
50
59
|
rspec-expectations (3.4.0)
|
51
60
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -54,15 +63,21 @@ GEM
|
|
54
63
|
diff-lcs (>= 1.2.0, < 2.0)
|
55
64
|
rspec-support (~> 3.4.0)
|
56
65
|
rspec-support (3.4.1)
|
66
|
+
semver (1.0.1)
|
67
|
+
thread_safe (0.3.5)
|
68
|
+
yard (0.8.7.6)
|
57
69
|
|
58
70
|
PLATFORMS
|
59
71
|
ruby
|
60
72
|
|
61
73
|
DEPENDENCIES
|
62
74
|
bundler (~> 1.0)
|
63
|
-
|
64
|
-
|
65
|
-
|
75
|
+
github-markup (~> 1.4)
|
76
|
+
gobject-introspection (~> 3.0)
|
77
|
+
jeweler (~> 2.0)
|
78
|
+
redcarpet (~> 3.3)
|
79
|
+
rspec (~> 3.3)
|
80
|
+
yard (~> 0.8)
|
66
81
|
|
67
82
|
BUNDLED WITH
|
68
|
-
1.
|
83
|
+
1.11.2
|
data/{LICENSE → LICENSE.txt}
RENAMED
data/README.md
CHANGED
@@ -1,30 +1,35 @@
|
|
1
|
-
# ruby-vips
|
1
|
+
# ruby-vips
|
2
2
|
|
3
|
-
|
3
|
+
*API break:* version 1.0 of this gem is an API break, see below for some notes
|
4
|
+
on why there is a break and how to update your code.
|
5
|
+
The older `ruby-vips` is still here and still maintained in branch
|
6
|
+
`0.3-stable`.
|
4
7
|
|
5
|
-
This
|
6
|
-
|
7
|
-
This gem is still being maintained, but for new projects you should look at
|
8
|
-
the newer [ruby-vips8](https://rubygems.org/gems/ruby-vips8) gem.
|
8
|
+
This gem provides a Ruby binding for the [vips image processing
|
9
|
+
library](http://www.vips.ecs.soton.ac.uk).
|
9
10
|
|
10
|
-
ruby-vips is fast and it can work without needing the
|
11
|
-
entire image
|
11
|
+
`ruby-vips` is fast and it can work without needing to have the
|
12
|
+
entire image loaded into memory. Programs that use `ruby-vips` don't
|
13
|
+
manipulate images directly, instead they create pipelines of image processing
|
14
|
+
operations building on a source image. When the end of the pipe is connected
|
15
|
+
to a destination, the whole pipline executes at once, streaming the image
|
16
|
+
in parallel from source to destination a section at a time.
|
17
|
+
|
18
|
+
For example, the benchmark at
|
12
19
|
[vips-benchmarks](https://github.com/stanislaw/vips-benchmarks) loads a large
|
13
|
-
image, crops, shrinks, sharpens and saves again
|
20
|
+
image, crops, shrinks, sharpens and saves again, and repeats 10 times.
|
14
21
|
|
15
22
|
```text
|
16
23
|
real time in seconds, fastest of three runs
|
17
24
|
benchmark tiff jpeg
|
18
|
-
ruby-vips.rb 2.
|
19
|
-
ruby-vips8.rb 2.97 3.29
|
25
|
+
ruby-vips.rb 2.97 3.29
|
20
26
|
image-magick 8.18 9.71
|
21
27
|
rmagick.rb 9.22 10.06
|
22
28
|
image_sci.rb 9.39 7.20
|
23
29
|
|
24
30
|
peak memory use in bytes
|
25
31
|
benchmark peak RSS
|
26
|
-
ruby-vips.rb
|
27
|
-
ruby-vips8.rb 117604
|
32
|
+
ruby-vips.rb 117604
|
28
33
|
image_sci.rb 146536
|
29
34
|
rmagick.rb 3352020
|
30
35
|
```
|
@@ -35,83 +40,39 @@ There's a handy blog post explaining [how libvips opens
|
|
35
40
|
files](http://libvips.blogspot.co.uk/2012/06/how-libvips-opens-file.html)
|
36
41
|
which gives some more background.
|
37
42
|
|
38
|
-
|
39
|
-
output the image to disk or to a string. This means you can create,
|
40
|
-
manipulate, and pass around Image objects without incurring any memory or CPU
|
41
|
-
costs. The image is not actually processed until you write the image to memory
|
42
|
-
or to disk.
|
43
|
-
|
44
|
-
*note*: ruby-vips will work with versions of libvips as far back as 7.12, but
|
45
|
-
with missing features and with reduced performance. For best results, use the
|
46
|
-
latest libvips you can.
|
47
|
-
|
48
|
-
## Requirements.
|
43
|
+
## Requirements
|
49
44
|
|
50
45
|
* OS X or Linux
|
51
|
-
*
|
52
|
-
* libvips 7.24 and later (it will work with earlier libvips, but some
|
53
|
-
features may not be functional)
|
46
|
+
* libvips 8.2 and later
|
54
47
|
|
55
48
|
## Installation prerequisites
|
56
49
|
|
57
|
-
### Ubuntu
|
58
|
-
|
59
|
-
```bash
|
60
|
-
$ apt-get install libvips-dev
|
61
|
-
```
|
62
|
-
|
63
50
|
### OS X
|
64
51
|
|
65
52
|
Install [homebrew](http://mxcl.github.com/homebrew) and enter:
|
66
53
|
|
67
54
|
```bash
|
68
|
-
$ brew
|
69
|
-
$ brew install vips
|
55
|
+
$ brew install homebrew/science/vips
|
70
56
|
```
|
71
57
|
|
72
|
-
You may see some harmless warnings.
|
73
|
-
|
74
58
|
To verify that your vips install is working, try:
|
75
59
|
|
76
60
|
```bash
|
77
61
|
$ vips --version
|
78
|
-
vips-
|
79
|
-
```
|
80
|
-
|
81
|
-
libvips has a lot of optional dependencies. You
|
82
|
-
may not need all of them. True `brew info vips` to see what you have enabled
|
83
|
-
and what is disabled. See also [the notes
|
84
|
-
here](http://www.vips.ecs.soton.ac.uk/index.php?title=Build_on_OS_X) for
|
85
|
-
more information.
|
86
|
-
|
87
|
-
If you want to build things outside homebrew which depend on vips,
|
88
|
-
such as ruby-vips, your pkg-config will need to be working. To test
|
89
|
-
`pkg-config`, try:
|
90
|
-
|
91
|
-
```bash
|
92
|
-
$ pkg-config vips --modversion
|
93
|
-
```
|
94
|
-
|
95
|
-
If you see a version number, you are OK. If you don't, either update your
|
96
|
-
homebrew, or try adjusting `PKG_CONFIG_PATH`. At various times homebrew has
|
97
|
-
needed various settings. You might need to point it at homebrew or even at
|
98
|
-
libxml2.
|
99
|
-
|
100
|
-
To verify that your `pkg-config` is working correctly with vips, try:
|
101
|
-
|
102
|
-
```bash
|
103
|
-
$ pkg-config vips --libs
|
104
|
-
-L/usr/local/Cellar/vips/7.42.1/lib ... a lot of stuff
|
62
|
+
vips-8.2.1
|
105
63
|
```
|
106
64
|
|
107
|
-
TODO: Describe & test with macports.
|
108
|
-
|
109
65
|
### Other platforms
|
110
66
|
|
111
|
-
|
112
|
-
|
67
|
+
You need to install libvips from source since 8.2 has not been packaged yet
|
68
|
+
(Jan 2016).
|
113
69
|
|
114
|
-
|
70
|
+
Download a tarball from the
|
71
|
+
[libvips website](http://www.vips.ecs.soton.ac.uk/supported/current), or build
|
72
|
+
from [the git repository](https://github.com/jcupitt/libvips) and see the
|
73
|
+
README.
|
74
|
+
|
75
|
+
## Installing the gem.
|
115
76
|
|
116
77
|
```bash
|
117
78
|
$ gem install ruby-vips
|
@@ -123,105 +84,100 @@ or include it in Gemfile:
|
|
123
84
|
gem 'ruby-vips'
|
124
85
|
```
|
125
86
|
|
126
|
-
|
127
|
-
|
128
|
-
```bash
|
129
|
-
$ gem install ruby-vips -- --enable-debug
|
130
|
-
```
|
87
|
+
And take a look in `examples/`. There is full yard documentation, take a look
|
88
|
+
there too.
|
131
89
|
|
132
|
-
|
133
|
-
|
134
|
-
ruby-vips has [rdoc
|
135
|
-
documentation](http://rubydoc.info/gems/ruby-vips/frames). Also
|
136
|
-
see [Wiki page](https://github.com/jcupitt/ruby-vips/wiki)
|
137
|
-
|
138
|
-
## Small example
|
139
|
-
|
140
|
-
See also the
|
141
|
-
[examples](https://github.com/jcupitt/ruby-vips/tree/master/examples)
|
142
|
-
directory.
|
90
|
+
# Example
|
143
91
|
|
144
92
|
```ruby
|
145
|
-
require 'rubygems'
|
146
93
|
require 'vips'
|
147
94
|
|
148
|
-
|
95
|
+
im = Vips::Image.new_from_file filename
|
149
96
|
|
150
|
-
#
|
151
|
-
#
|
152
|
-
|
97
|
+
# put im at position (100, 100) in a 3000 x 3000 pixel image,
|
98
|
+
# make the other pixels in the image by mirroring im up / down /
|
99
|
+
# left / right, see
|
100
|
+
# http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/libvips-conversion.html#vips-embed
|
101
|
+
im = im.embed 100, 100, 3000, 3000, :extend => :mirror
|
153
102
|
|
154
|
-
#
|
155
|
-
|
103
|
+
# multiply the green (middle) band by 2, leave the other two alone
|
104
|
+
im *= [1, 2, 1]
|
156
105
|
|
157
|
-
#
|
158
|
-
|
159
|
-
|
160
|
-
|
106
|
+
# make an image from an array constant, convolve with it
|
107
|
+
mask = Vips::Image.new_from_array [
|
108
|
+
[-1, -1, -1],
|
109
|
+
[-1, 16, -1],
|
110
|
+
[-1, -1, -1]], 8
|
111
|
+
im = im.conv mask
|
161
112
|
|
162
|
-
#
|
163
|
-
|
164
|
-
|
113
|
+
# finally, write the result back to a file on disk
|
114
|
+
im.write_to_file output_filename
|
115
|
+
```
|
165
116
|
|
166
|
-
#
|
167
|
-
# actually loaded and resized. With images that allow for random access from
|
168
|
-
# the hard drive (VIPS native format, tiled OpenEXR, ppm/pbm/pgm/pfm, tiled
|
169
|
-
# tiff, and RAW images), the entire image is never read into memory.
|
170
|
-
# For other formats, the image is either decompressed to a temporary disc
|
171
|
-
# file and then processed from there, or, if you give the :sequential hint,
|
172
|
-
# streamed directly from the file.
|
173
|
-
im_shrink_by_two.png('out.png', :interlace => true)
|
117
|
+
# Why the API break?
|
174
118
|
|
175
|
-
|
176
|
-
|
177
|
-
|
119
|
+
There's been a `ruby-vips` for a few years now.
|
120
|
+
It was written by a Ruby
|
121
|
+
expert, it works well, it includes a test-suite, and has pretty full
|
122
|
+
documentation. Why rewrite?
|
178
123
|
|
179
|
-
|
180
|
-
|
181
|
-
|
124
|
+
`ruby-vips` 0.3 was based on the old vips7 API. There's now vips8,
|
125
|
+
which adds several
|
126
|
+
very useful new features:
|
182
127
|
|
183
|
-
|
184
|
-
|
128
|
+
* [GObject](https://developer.gnome.org/gobject/stable/)-based API with full
|
129
|
+
introspection. You can discover the vips8 API at runtime. This means that if
|
130
|
+
libvips gets a new operator, any binding that goes via vips8 will
|
131
|
+
get the new thing immediately. With vips7, whenever libvips was changed, all
|
132
|
+
the bindings needed to be changed too.
|
185
133
|
|
186
|
-
|
187
|
-
|
188
|
-
|
134
|
+
* No C required. Thanks to
|
135
|
+
[gobject-introspection](https://wiki.gnome.org/Projects/GObjectIntrospection)
|
136
|
+
you can write the binding in Ruby itself, there's no need for any C. This
|
137
|
+
makes it a lot smaller and more portable.
|
189
138
|
|
190
|
-
|
139
|
+
* vips7 probably won't get new features. vips7 doesn't really exist any more:
|
140
|
+
the API is still there, but now just a thin compatibility layer over vips8.
|
141
|
+
New features may well not get added to the vips7 API.
|
191
142
|
|
192
|
-
|
193
|
-
reader = JPEGReader.new(jpeg_data, :shrink_factor => 2, :fail_on_warn => true)
|
194
|
-
im = reader.read_buffer
|
143
|
+
There are some more minor pluses as well:
|
195
144
|
|
196
|
-
|
197
|
-
|
198
|
-
|
145
|
+
* Named and optional arguments. vips8 lets you have optional and required
|
146
|
+
arguments, both input and output, and optional arguments can have default
|
147
|
+
values.
|
199
148
|
|
200
|
-
|
201
|
-
|
149
|
+
* Operation cache. vips8 keeps track of the last 1,000 or so operations and
|
150
|
+
will automatically reuse results when it can. This can give a huge speedup
|
151
|
+
in some cases.
|
202
152
|
|
203
|
-
|
204
|
-
|
205
|
-
|
153
|
+
* vips8 is much simpler and more regular. For example,
|
154
|
+
ruby-vips had to work hard to offer a nice loader system, but that's all
|
155
|
+
built into vips8. It can do things like load and save formatted images to
|
156
|
+
and from memory buffers as well, which just wasn't possible before.
|
206
157
|
|
207
|
-
|
208
|
-
# and png memory read is only in vips-7.34 and later.
|
158
|
+
This binding adds some extra useful features over the old `ruby-vips` binding.
|
209
159
|
|
210
|
-
|
160
|
+
* Full set of arithmetic operator overloads.
|
211
161
|
|
212
|
-
|
213
|
-
|
214
|
-
|
162
|
+
* Automatic constant expansion. You can write things like
|
163
|
+
`image.bandjoin(255)` and the 255 will be automatically expanded to an image
|
164
|
+
and attached as an extra band. You can mix int, float, scalar, vector and
|
165
|
+
image constants freely.
|
215
166
|
|
216
|
-
|
217
|
-
jpeg_data = writer.to_memory
|
218
|
-
IO.write('out.jpg', jpeg_data)
|
167
|
+
# How to update your code
|
219
168
|
|
220
|
-
|
169
|
+
* `VIPS::` becomes `Vips::`
|
170
|
+
|
171
|
+
* `VIPS::Image.new(filename)` becomes `Vips::Image.new_from_file(filename)`.
|
172
|
+
`VIPS::Image.jpeg(filename)` also becomes
|
173
|
+
`Vips::Image.new_from_file(filename)`, similarly for other formats.
|
174
|
+
|
175
|
+
* `#write(filename)` becomes `#write_to_file(filename)`. `#png(filename)` also
|
176
|
+
becomes `#write_to_file(filename)`, same for all other
|
177
|
+
formats.
|
221
178
|
|
222
|
-
|
179
|
+
* Most member functions are unchanged, but check the yard docs. You can also
|
180
|
+
use the C docs directly, since `ruby-vips` is now a very thin layer over the
|
181
|
+
C API. See the docs for the `Vips` class for guidance.
|
223
182
|
|
224
|
-
|
225
|
-
- Operations are chainable and do not get executed until the image is sent to an output.
|
226
|
-
- Memory use is low, even for very, very large images.
|
227
|
-
- Fastest ruby library for resizing large images. See [benchmarks at the official libvips website](http://www.vips.ecs.soton.ac.uk/index.php?title=Speed_and_Memory_Use) and [vips-benchmarks](https://github.com/stanislaw/vips-benchmarks)
|
183
|
+
* There are lots of nice new features, see the docs and examples.
|