ruby-vips 0.2.0 → 0.2.1
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.
- data/CHANGELOG.md +8 -1
- data/README.md +5 -2
- data/lib/vips.rb +9 -0
- data/lib/vips/reader.rb +24 -26
- data/lib/vips/version.rb +1 -1
- data/ruby-vips.gemspec +2 -2
- metadata +3 -3
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
from git master of libvips (the unreleased 7.29) as well. You may prefer
|
|
5
5
|
the stable 0.2 branch of ruby-vips.
|
|
6
6
|
|
|
7
|
+
[](http://travis-ci.org/jcupitt/ruby-vips)
|
|
8
|
+
|
|
7
9
|
ruby-vips is a ruby extension for [vips](http://www.vips.ecs.soton.ac.uk).
|
|
8
10
|
It is extremely fast and it can process huge images without requiring the
|
|
9
11
|
entire image to be loaded into memory. For example, the benchmark at
|
|
10
12
|
[vips-benchmarks](https://github.com/stanislaw/vips-benchmarks) loads a large
|
|
11
13
|
image, crops, shrinks, sharpens and saves again:
|
|
12
14
|
|
|
13
|
-
[](http://travis-ci.org/jcupitt/ruby-vips)
|
|
14
|
-
|
|
15
15
|
<pre>
|
|
16
16
|
real time in seconds, fastest of three runs
|
|
17
17
|
benchmark tiff jpeg
|
|
@@ -30,6 +30,9 @@ rmagick.rb 1370064
|
|
|
30
30
|
|
|
31
31
|
See also [benchmarks at the official libvips
|
|
32
32
|
website](http://www.vips.ecs.soton.ac.uk/index.php?title=Speed_and_Memory_Use).
|
|
33
|
+
There's a handy blog post explaining [how libvips opens
|
|
34
|
+
files](http://libvips.blogspot.co.uk/2012/06/how-libvips-opens-file.html)
|
|
35
|
+
which gives some more background.
|
|
33
36
|
|
|
34
37
|
ruby-vips allows you to set up pipelines that don't get executed until you
|
|
35
38
|
output the image to disk or to a string. This means you can create,
|
data/lib/vips.rb
CHANGED
data/lib/vips/reader.rb
CHANGED
|
@@ -24,15 +24,10 @@ module VIPS
|
|
|
24
24
|
|
|
25
25
|
# Creates a CSV reader.
|
|
26
26
|
def initialize(path, options={})
|
|
27
|
-
@line_skip = 0
|
|
28
|
-
@whitespace = ' "'
|
|
29
|
-
@separator = ";,\t"
|
|
30
|
-
@line_limit = 0
|
|
31
|
-
|
|
32
|
-
self.line_skip = options[:line_skip] if options.has_key?(:line_skip)
|
|
33
|
-
self.whitespace = options[:whitespace] if options.has_key?(:whitespace)
|
|
34
|
-
self.separator = options[:separator] if options.has_key?(:separator)
|
|
35
|
-
self.line_limit = options[:line_limit] if options.has_key?(:line_limit)
|
|
27
|
+
@line_skip = options[:line_skip] || 0
|
|
28
|
+
@whitespace = options[:whitespace] || ' "'
|
|
29
|
+
@separator = options[:separator] || ";,\t"
|
|
30
|
+
@line_limit = options[:line_limit] || 0
|
|
36
31
|
|
|
37
32
|
super path, options
|
|
38
33
|
end
|
|
@@ -75,13 +70,9 @@ module VIPS
|
|
|
75
70
|
|
|
76
71
|
# Creates a jpeg image file reader.
|
|
77
72
|
def initialize(path, options={})
|
|
78
|
-
@shrink_factor = 1
|
|
79
|
-
@fail_on_warn = false
|
|
80
|
-
@sequential = false
|
|
81
|
-
|
|
82
|
-
self.shrink_factor = options[:shrink_factor] if options.has_key?(:shrink_factor)
|
|
83
|
-
self.fail_on_warn = options[:fail_on_warn] if options.has_key?(:fail_on_warn)
|
|
84
|
-
self.sequential = options[:sequential] if options.has_key?(:sequential)
|
|
73
|
+
@shrink_factor = options[:shrink_factor] || 1
|
|
74
|
+
@fail_on_warn = options[:fail_on_warn] || false
|
|
75
|
+
@sequential = options[:sequential] || false
|
|
85
76
|
|
|
86
77
|
super path, options
|
|
87
78
|
end
|
|
@@ -91,8 +82,11 @@ module VIPS
|
|
|
91
82
|
str = "#{@path}:#{shrink_factor}"
|
|
92
83
|
str << ","
|
|
93
84
|
str << "fail" if @fail_on_warn
|
|
94
|
-
|
|
95
|
-
|
|
85
|
+
|
|
86
|
+
if Vips.sequential_mode_supported?
|
|
87
|
+
str << ","
|
|
88
|
+
str << "sequential" if @sequential
|
|
89
|
+
end
|
|
96
90
|
|
|
97
91
|
read_internal str
|
|
98
92
|
end
|
|
@@ -116,10 +110,9 @@ module VIPS
|
|
|
116
110
|
# Create a tiff image file reader.
|
|
117
111
|
def initialize(path, options={})
|
|
118
112
|
@page_number = nil
|
|
119
|
-
@sequential = false
|
|
113
|
+
@sequential = options[:sequential] || false
|
|
120
114
|
|
|
121
115
|
self.page_number = options[:page_number] if options.has_key?(:page_number)
|
|
122
|
-
self.sequential = options[:sequential] if options.has_key?(:sequential)
|
|
123
116
|
super path, options
|
|
124
117
|
end
|
|
125
118
|
|
|
@@ -127,8 +120,11 @@ module VIPS
|
|
|
127
120
|
def read
|
|
128
121
|
str = "#{@path}:"
|
|
129
122
|
str << "#{@page_number}" if @page_number
|
|
130
|
-
|
|
131
|
-
|
|
123
|
+
|
|
124
|
+
if Vips.sequential_mode_supported?
|
|
125
|
+
str << ","
|
|
126
|
+
str << "sequential" if @sequential
|
|
127
|
+
end
|
|
132
128
|
|
|
133
129
|
read_internal str
|
|
134
130
|
end
|
|
@@ -149,17 +145,19 @@ module VIPS
|
|
|
149
145
|
|
|
150
146
|
# Create a png image file reader.
|
|
151
147
|
def initialize(path, options={})
|
|
152
|
-
@sequential = false
|
|
148
|
+
@sequential = options[:sequential] || false
|
|
153
149
|
|
|
154
|
-
self.sequential = options[:sequential] if options.has_key?(:sequential)
|
|
155
150
|
super path, options
|
|
156
151
|
end
|
|
157
152
|
|
|
158
153
|
# Read the png file from disk and return a VIPS Image object.
|
|
159
154
|
def read
|
|
160
155
|
str = @path
|
|
161
|
-
|
|
162
|
-
|
|
156
|
+
|
|
157
|
+
if Vips.sequential_mode_supported?
|
|
158
|
+
str << ":"
|
|
159
|
+
str << "sequential" if @sequential
|
|
160
|
+
end
|
|
163
161
|
|
|
164
162
|
read_internal str
|
|
165
163
|
end
|
data/lib/vips/version.rb
CHANGED
data/ruby-vips.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = "ruby-vips"
|
|
8
|
-
s.version = "0.2.
|
|
8
|
+
s.version = "0.2.1"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Timothy Elliott", "John Cupitt"]
|
|
12
|
-
s.date = "2012-
|
|
12
|
+
s.date = "2012-07-16"
|
|
13
13
|
s.description = "Ruby extension for the vips image processing library."
|
|
14
14
|
s.email = "jcupitt@gmail.com"
|
|
15
15
|
s.extensions = ["ext/extconf.rb"]
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-vips
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2012-
|
|
13
|
+
date: 2012-07-16 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rdoc
|
|
@@ -146,7 +146,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
146
146
|
version: '0'
|
|
147
147
|
segments:
|
|
148
148
|
- 0
|
|
149
|
-
hash:
|
|
149
|
+
hash: 204024303
|
|
150
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
151
|
none: false
|
|
152
152
|
requirements:
|