ruby-vips8 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +1 -0
  3. data/.yardopts +10 -0
  4. data/CHANGELOG.md +5 -0
  5. data/Gemfile +15 -0
  6. data/Gemfile.lock +84 -0
  7. data/LICENSE.txt +20 -0
  8. data/README.md +170 -0
  9. data/Rakefile +45 -0
  10. data/TODO +11 -0
  11. data/VERSION +1 -0
  12. data/example/annotate.rb +17 -0
  13. data/example/daltonize8.rb +75 -0
  14. data/example/example1.rb +84 -0
  15. data/example/example2.rb +31 -0
  16. data/example/example3.rb +19 -0
  17. data/example/example4.rb +18 -0
  18. data/example/example5.rb +31 -0
  19. data/example/trim8.rb +41 -0
  20. data/example/watermark.rb +44 -0
  21. data/example/wobble.rb +36 -0
  22. data/lib/vips8.rb +153 -0
  23. data/lib/vips8/access.rb +14 -0
  24. data/lib/vips8/align.rb +11 -0
  25. data/lib/vips8/angle.rb +12 -0
  26. data/lib/vips8/angle45.rb +16 -0
  27. data/lib/vips8/argument.rb +163 -0
  28. data/lib/vips8/bandformat.rb +20 -0
  29. data/lib/vips8/call.rb +302 -0
  30. data/lib/vips8/coding.rb +14 -0
  31. data/lib/vips8/demandstyle.rb +35 -0
  32. data/lib/vips8/direction.rb +11 -0
  33. data/lib/vips8/error.rb +30 -0
  34. data/lib/vips8/extend.rb +22 -0
  35. data/lib/vips8/foreignflags.rb +20 -0
  36. data/lib/vips8/image.rb +1383 -0
  37. data/lib/vips8/interpolate.rb +37 -0
  38. data/lib/vips8/interpretation.rb +28 -0
  39. data/lib/vips8/methods.rb +1807 -0
  40. data/lib/vips8/operation.rb +19 -0
  41. data/ruby-vips8.gemspec +112 -0
  42. data/spec/image_spec.rb +515 -0
  43. data/spec/samples/balloon.v +0 -0
  44. data/spec/samples/ghost.ppm +405 -0
  45. data/spec/samples/huge.jpg +0 -0
  46. data/spec/samples/icc.jpg +0 -0
  47. data/spec/samples/lcd.icc +0 -0
  48. data/spec/samples/lion.svg +154 -0
  49. data/spec/samples/sample.csv +7 -0
  50. data/spec/samples/sample.exr +0 -0
  51. data/spec/samples/wagon.jpg +0 -0
  52. data/spec/samples/wagon.v +0 -0
  53. data/spec/spec_helper.rb +49 -0
  54. data/spec/vips_spec.rb +74 -0
  55. metadata +198 -0
@@ -0,0 +1,7 @@
1
+ 0,0,0,255,0,0,0
2
+ 0,0,0,255,0,0,0
3
+ 0,0,0,255,0,0,0
4
+ 0,0,0,255,0,0,0
5
+ 0,255,0,255,0,0,0
6
+ 0,255,0,255,0,0,0
7
+ 0,0,255,255,0,0,0
Binary file
Binary file
Binary file
@@ -0,0 +1,49 @@
1
+ require 'vips8'
2
+
3
+ require 'tempfile'
4
+
5
+ module Spec
6
+
7
+ module Path
8
+ def root
9
+ @root ||= Pathname.new(File.expand_path('..', __FILE__))
10
+ end
11
+
12
+ def sample(*path)
13
+ root.join 'samples', *path
14
+ end
15
+
16
+ def tmp(*path)
17
+ root.join 'tmp', 'working', *path
18
+ end
19
+
20
+ extend self
21
+
22
+ end
23
+
24
+ module Helpers
25
+ def reset_working!
26
+ FileUtils.rm Dir[tmp.join('*.*')]
27
+ FileUtils.mkdir_p(tmp)
28
+ end
29
+ end
30
+
31
+ end
32
+
33
+ def simg(name)
34
+ Spec::Path::sample(name).to_s
35
+ end
36
+
37
+ def timg(name)
38
+ Spec::Path::tmp(name).to_s
39
+ end
40
+
41
+ RSpec.configure do |config|
42
+ config.include Spec::Path
43
+ config.include Spec::Helpers
44
+
45
+ config.before :each do
46
+ reset_working!
47
+ end
48
+
49
+ end
@@ -0,0 +1,74 @@
1
+ require 'spec_helper.rb'
2
+
3
+ RSpec.describe Vips do
4
+ describe '#call' do
5
+ it 'can make a black image' do
6
+ image = Vips::call "black", 200, 200
7
+
8
+ expect(image.width).to eq(200)
9
+ expect(image.height).to eq(200)
10
+ expect(image.bands).to eq(1)
11
+ end
12
+
13
+ it 'can take an optional argument' do
14
+ image = Vips::call "black", 200, 200, :bands => 12
15
+
16
+ expect(image.width).to eq(200)
17
+ expect(image.height).to eq(200)
18
+ expect(image.bands).to eq(12)
19
+ end
20
+
21
+ it 'can take an optional argument' do
22
+ image = Vips::call "black", 200, 200, :bands => 12
23
+
24
+ expect(image.width).to eq(200)
25
+ expect(image.height).to eq(200)
26
+ expect(image.bands).to eq(12)
27
+ end
28
+
29
+ it 'can handle enum arguments' do
30
+ black = Vips::call "black", 200, 200
31
+ embed = Vips::call "embed", black, 10, 10, 500, 500,
32
+ :extend => :mirror
33
+
34
+ expect(embed.width).to eq(500)
35
+ expect(embed.height).to eq(500)
36
+ expect(embed.bands).to eq(1)
37
+ end
38
+
39
+ it 'enum arguments can be strings' do
40
+ black = Vips::call "black", 200, 200
41
+ embed = Vips::call "embed", black, 10, 10, 500, 500,
42
+ :extend => "mirror"
43
+
44
+ expect(embed.width).to eq(500)
45
+ expect(embed.height).to eq(500)
46
+ expect(embed.bands).to eq(1)
47
+ end
48
+
49
+ it 'can return optional output args' do
50
+ point = Vips::call "black", 1, 1
51
+ test = Vips::call "embed", point, 20, 10, 100, 100,
52
+ :extend => :white
53
+ value, opts = Vips::call "min", test, :x => true, :y => true
54
+
55
+ expect(value).to eq(0)
56
+ expect(opts['x']).to eq(20)
57
+ expect(opts['y']).to eq(10)
58
+ end
59
+
60
+ it 'can call draw operations' do
61
+ black = Vips::call "black", 100, 100
62
+ test = Vips::call "draw_rect", black, 255, 10, 10, 1, 1
63
+
64
+ max_black = Vips::call "max", black
65
+ max_test = Vips::call "max", test
66
+
67
+ expect(max_black).to eq(0)
68
+ expect(max_test).to eq(255)
69
+ end
70
+
71
+ end
72
+
73
+ end
74
+
metadata ADDED
@@ -0,0 +1,198 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby-vips8
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - John Cupitt
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gobject-introspection
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: yard
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.8'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.8'
55
+ - !ruby/object:Gem::Dependency
56
+ name: redcarpet
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.3'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: github-markup
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.4'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.4'
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: jeweler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '2.0'
111
+ description: ruby-vips8 is a ruby extension for vips8. It is extremely fast and it
112
+ can process huge images without requiring the entire image to be loaded into memory.
113
+ email: jcupitt@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files:
117
+ - LICENSE.txt
118
+ - README.md
119
+ - TODO
120
+ files:
121
+ - ".rspec"
122
+ - ".yardopts"
123
+ - CHANGELOG.md
124
+ - Gemfile
125
+ - Gemfile.lock
126
+ - LICENSE.txt
127
+ - README.md
128
+ - Rakefile
129
+ - TODO
130
+ - VERSION
131
+ - example/annotate.rb
132
+ - example/daltonize8.rb
133
+ - example/example1.rb
134
+ - example/example2.rb
135
+ - example/example3.rb
136
+ - example/example4.rb
137
+ - example/example5.rb
138
+ - example/trim8.rb
139
+ - example/watermark.rb
140
+ - example/wobble.rb
141
+ - lib/vips8.rb
142
+ - lib/vips8/access.rb
143
+ - lib/vips8/align.rb
144
+ - lib/vips8/angle.rb
145
+ - lib/vips8/angle45.rb
146
+ - lib/vips8/argument.rb
147
+ - lib/vips8/bandformat.rb
148
+ - lib/vips8/call.rb
149
+ - lib/vips8/coding.rb
150
+ - lib/vips8/demandstyle.rb
151
+ - lib/vips8/direction.rb
152
+ - lib/vips8/error.rb
153
+ - lib/vips8/extend.rb
154
+ - lib/vips8/foreignflags.rb
155
+ - lib/vips8/image.rb
156
+ - lib/vips8/interpolate.rb
157
+ - lib/vips8/interpretation.rb
158
+ - lib/vips8/methods.rb
159
+ - lib/vips8/operation.rb
160
+ - ruby-vips8.gemspec
161
+ - spec/image_spec.rb
162
+ - spec/samples/balloon.v
163
+ - spec/samples/ghost.ppm
164
+ - spec/samples/huge.jpg
165
+ - spec/samples/icc.jpg
166
+ - spec/samples/lcd.icc
167
+ - spec/samples/lion.svg
168
+ - spec/samples/sample.csv
169
+ - spec/samples/sample.exr
170
+ - spec/samples/wagon.jpg
171
+ - spec/samples/wagon.v
172
+ - spec/spec_helper.rb
173
+ - spec/vips_spec.rb
174
+ homepage: http://github.com/jcupitt/ruby-vips8
175
+ licenses:
176
+ - MIT
177
+ metadata: {}
178
+ post_install_message:
179
+ rdoc_options: []
180
+ require_paths:
181
+ - lib
182
+ required_ruby_version: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
187
+ required_rubygems_version: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - ">="
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
192
+ requirements: []
193
+ rubyforge_project:
194
+ rubygems_version: 2.2.2
195
+ signing_key:
196
+ specification_version: 4
197
+ summary: Ruby extension for the vips8 image processing library.
198
+ test_files: []