ruby-vips 0.3.14 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +22 -0
  3. data/CHANGELOG.md +4 -0
  4. data/Gemfile +15 -0
  5. data/Gemfile.lock +46 -31
  6. data/{LICENSE → LICENSE.txt} +1 -1
  7. data/README.md +101 -145
  8. data/Rakefile +45 -0
  9. data/TODO +8 -32
  10. data/VERSION +1 -0
  11. data/example/annotate.rb +17 -0
  12. data/example/daltonize8.rb +75 -0
  13. data/example/example1.rb +84 -0
  14. data/example/example2.rb +31 -0
  15. data/example/example3.rb +19 -0
  16. data/example/example4.rb +18 -0
  17. data/example/example5.rb +31 -0
  18. data/example/trim8.rb +41 -0
  19. data/example/watermark.rb +44 -0
  20. data/example/wobble.rb +36 -0
  21. data/lib/vips.rb +151 -14
  22. data/lib/vips/access.rb +14 -0
  23. data/lib/vips/align.rb +11 -0
  24. data/lib/vips/angle.rb +12 -0
  25. data/lib/vips/angle45.rb +16 -0
  26. data/lib/vips/argument.rb +163 -0
  27. data/lib/vips/bandformat.rb +20 -0
  28. data/lib/vips/call.rb +302 -0
  29. data/lib/vips/coding.rb +14 -0
  30. data/lib/vips/demandstyle.rb +35 -0
  31. data/lib/vips/direction.rb +11 -0
  32. data/lib/vips/error.rb +30 -0
  33. data/lib/vips/extend.rb +22 -0
  34. data/lib/vips/foreignflags.rb +20 -0
  35. data/lib/vips/image.rb +1382 -0
  36. data/lib/vips/interpolate.rb +37 -0
  37. data/lib/vips/interpretation.rb +28 -0
  38. data/lib/vips/methods.rb +1807 -0
  39. data/lib/vips/operation.rb +19 -0
  40. data/ruby-vips8.gemspec +112 -0
  41. data/spec/image_spec.rb +515 -0
  42. data/spec/samples/balloon.v +0 -0
  43. data/spec/samples/ghost.ppm +405 -0
  44. data/spec/samples/huge.jpg +0 -0
  45. data/spec/samples/icc.jpg +0 -0
  46. data/spec/samples/lcd.icc +0 -0
  47. data/spec/samples/lion.svg +154 -0
  48. data/spec/samples/sample.csv +7 -0
  49. data/spec/samples/sample.exr +0 -0
  50. data/spec/samples/wagon.jpg +0 -0
  51. data/spec/samples/wagon.v +0 -0
  52. data/spec/spec_helper.rb +49 -0
  53. data/spec/vips_spec.rb +74 -0
  54. metadata +110 -70
  55. data/ext/extconf.rb +0 -31
  56. data/ext/header.c +0 -457
  57. data/ext/header.h +0 -9
  58. data/ext/image.c +0 -629
  59. data/ext/image.h +0 -72
  60. data/ext/image_arithmetic.c +0 -936
  61. data/ext/image_arithmetic.h +0 -38
  62. data/ext/image_boolean.c +0 -301
  63. data/ext/image_boolean.h +0 -8
  64. data/ext/image_colour.c +0 -590
  65. data/ext/image_colour.h +0 -36
  66. data/ext/image_conversion.c +0 -884
  67. data/ext/image_conversion.h +0 -38
  68. data/ext/image_convolution.c +0 -368
  69. data/ext/image_convolution.h +0 -13
  70. data/ext/image_freq_filt.c +0 -740
  71. data/ext/image_freq_filt.h +0 -27
  72. data/ext/image_histograms_lut.c +0 -643
  73. data/ext/image_histograms_lut.h +0 -28
  74. data/ext/image_morphology.c +0 -327
  75. data/ext/image_morphology.h +0 -13
  76. data/ext/image_mosaicing.c +0 -554
  77. data/ext/image_mosaicing.h +0 -15
  78. data/ext/image_relational.c +0 -384
  79. data/ext/image_relational.h +0 -8
  80. data/ext/image_resample.c +0 -249
  81. data/ext/image_resample.h +0 -9
  82. data/ext/interpolator.c +0 -106
  83. data/ext/interpolator.h +0 -7
  84. data/ext/mask.c +0 -347
  85. data/ext/mask.h +0 -18
  86. data/ext/reader.c +0 -261
  87. data/ext/reader.h +0 -2
  88. data/ext/ruby_vips.c +0 -188
  89. data/ext/ruby_vips.h +0 -72
  90. data/ext/tags +0 -450
  91. data/ext/writer.c +0 -371
  92. data/ext/writer.h +0 -2
  93. data/lib/vips/reader.rb +0 -272
  94. data/lib/vips/version.rb +0 -3
  95. data/lib/vips/writer.rb +0 -342
  96. data/ruby-vips.gemspec +0 -100
  97. data/ruby.supp +0 -134
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 089ea1c945c987de705749f712762e4ed5f74aa3
4
- data.tar.gz: 6feeff8d78b3ca3e8e3ee63a65d9384787b327d0
3
+ metadata.gz: a944b8cabe34780ee544fb8504a6618efd94c674
4
+ data.tar.gz: b5740fa6840ce9905fa30870a6100b49b9adc1f2
5
5
  SHA512:
6
- metadata.gz: d9c675ca4def94a475f0578e856dc130b56484688aa3b2751eda49e2a68050eb63f9442b07d69f4cf757905f7801e32fe21eaf130b5fd2117e96778427bcc8e8
7
- data.tar.gz: 865652f25e10add687e72e2596e013bf56b114b7dae1966a9b388c71adbd9188fbbed8b31497c4d9ad5070dede456263b8d99a38718100f2464cbcdb20e12dd7
6
+ metadata.gz: f1b926ab064590c3f67ce2f346af93696d413c05787e56263ef1d46ef89d8a16f0f705c9edd6d85e1560a660cbae644f456eab17c4f8df81da2844781b221438
7
+ data.tar.gz: 3c337597296afec5e3464fd12052823780a0cde94774dbc2bb39cc289be21230604d3774d72d85fc2498d9acb1ac7e17c7ebca4567b7d1a961b36829e30eb757
@@ -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
@@ -1,5 +1,9 @@
1
1
  # master
2
2
 
3
+ # Version 1.0.0
4
+
5
+ * complete rewrite, API break [John Cupitt]
6
+
3
7
  # Version 0.3.14
4
8
 
5
9
  * more GC tuning [felixbuenemann]
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
@@ -1,51 +1,60 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- addressable (2.3.6)
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.9)
8
- multipart-post (~> 1.2.0)
9
- git (1.2.7)
10
- github_api (0.10.1)
11
- addressable
12
- faraday (~> 0.8.1)
13
- hashie (>= 1.2)
14
- multi_json (~> 1.4)
15
- nokogiri (~> 1.5.2)
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
- hashie (3.2.0)
18
- highline (1.6.21)
19
- jeweler (1.8.8)
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 (~> 1.0)
27
+ bundler (>= 1.0)
22
28
  git (>= 1.2.5)
23
- github_api (= 0.10.1)
29
+ github_api
24
30
  highline (>= 1.6.15)
25
- nokogiri (= 1.5.10)
31
+ nokogiri (>= 1.5.10)
26
32
  rake
27
33
  rdoc
34
+ semver
28
35
  json (1.8.3)
29
- jwt (1.0.0)
30
- multi_json (1.10.1)
36
+ jwt (1.5.1)
37
+ multi_json (1.12.1)
31
38
  multi_xml (0.5.5)
32
- multipart-post (1.2.0)
33
- nokogiri (1.5.10)
34
- oauth2 (1.0.0)
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 (~> 1.2)
40
- rack (1.5.2)
41
- rake (10.2.2)
42
- rdoc (3.12.2)
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.1)
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
- jeweler (~> 1.8)
64
- rdoc (~> 3.12)
65
- rspec (~> 3.4)
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.10.6
83
+ 1.11.2
@@ -1,4 +1,4 @@
1
- Copyright (c) 2010 Timothy Elliott
1
+ Copyright (c) 2014 John Cupitt
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,30 +1,35 @@
1
- # ruby-vips : A fast image processing extension for Ruby.
1
+ # ruby-vips
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/jcupitt/ruby-vips.png)](http://travis-ci.org/jcupitt/ruby-vips)
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 is `ruby-vips`, a gem for the
6
- [libvips](http://www.vips.ecs.soton.ac.uk) image processing library.
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 to be loaded into memory. For example, the benchmark at
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.77 2.98
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 107340
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
- ruby-vips allows you to set up pipelines that don't get executed until you
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
- * MRI 1.8.7, 1.9.3
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 tap homebrew/science
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-7.42.1-Sat Dec 27 12:01:43 GMT 2014
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
- See [Installation on various
112
- platforms](https://github.com/jcupitt/ruby-vips/wiki/installation-on-various-platforms).
67
+ You need to install libvips from source since 8.2 has not been packaged yet
68
+ (Jan 2016).
113
69
 
114
- ### Installing the gem.
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
- For a debug build:
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
- ## Documentation.
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
- include VIPS
95
+ im = Vips::Image.new_from_file filename
149
96
 
150
- # Create an image object. It will not actually load the pixel data until
151
- # needed.
152
- im = Image.jpeg('mypic.jpg')
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
- # You can read all the header fields without triggering a pixel load.
155
- puts "it's #{im.x_size} pixels across!"
103
+ # multiply the green (middle) band by 2, leave the other two alone
104
+ im *= [1, 2, 1]
156
105
 
157
- # Shrink the jpeg by a factor of four when loading -- huge speed and CPU
158
- # improvements on large images.
159
- im = Image.jpeg('mypic.jpg', :shrink_factor => 4)
160
- puts "but only #{im.x_size} pixels when we shrink on load"
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
- # Add a shrink by a factor of two to the pipeline. This will not actually be
163
- # executed yet.
164
- im_shrink_by_two = im.shrink(2)
113
+ # finally, write the result back to a file on disk
114
+ im.write_to_file output_filename
115
+ ```
165
116
 
166
- # Write out the shrunk image to a PNG file. This is where the image is
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
- # All ruby-vips image commands can be chained, so the above sequence could
176
- # be written as:
177
- Image.jpeg('mypic.jpg', :shrink_factor => 4).shrink(2).png('out.png')
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
- # You hint sequential mode in the loader, so this will stream directly from
180
- # the source image:
181
- Image.jpeg('large.png', :sequential => true).shrink(2).png('out.png')
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
- # The statement above will load the jpeg (pre-shrunk by a factor of four),
184
- # shrink the image again by a factor of two, and then save as a png image.
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
- # If you want to let vips determine file formats, you can use the generic
187
- # reader and writer:
188
- Image.new('mypic.jpg').shrink(2).write('out.png')
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
- # You can also read and write images from memory areas. For example:
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
- jpeg_data = IO.read('mypic.jpg')
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
- # As above, the image will not be processed until the .to_memory() method
197
- # is called, and then will only decompress the section being processed.
198
- # You will need to have all of the compressed data in memory at once though.
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
- # Note that this means you will get a coredump if you free the compressed
201
- # image buffer (jpeg_data above) before the write has completed.
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
- writer = PNGWriter.new(im, :compression => 2, :interlace => false)
204
- png_data = writer.to_memory
205
- IO.write('out.png', png_data)
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
- # Only JPEG, PNG and uncompressed memory images are supported at the moment,
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
- # We hope to add other formats in future.
160
+ * Full set of arithmetic operator overloads.
211
161
 
212
- png_data = IO.read('mypic.png')
213
- reader = PNGReader.new(png_data)
214
- im = reader.read_buffer
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
- writer = JPEGWriter.new(im, :quality => 50)
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
- ## Why use ruby-vips?
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
- - It supports over 250 low-level image and color manipulation operations.
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.