This gem provides a Ruby binding for the vips image processing
Programs that use ruby-vips don't manipulate images directly, instead they create pipelines of image processing operations building on a source image. When the end of the pipe is connected to a destination, the whole pipeline executes at once, streaming the image in parallel from source to destination a section at a time.
Because ruby-vips is very parallel, it's quick, and because it doesn't need to keep entire images in memory, it's light. For example, the benchmark at vips-benchmarks loads a large image, crops, shrinks, sharpens and saves again, and repeats 10 times.
ruby-vips alternatives and similar gems
Based on the "Image Processing" category.
Alternatively, view ruby-vips alternatives based on common mentions on social networks and blogs.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of ruby-vips or a related project?
This gem is a Ruby binding for the libvips image processing library.
macOS, Linux, and Windows tested
libvips 8.2 or later, see the libvips install instructions
ruby-ffi 1.9 or later
Ruby 2.0+, JRuby
Install libvips, then:
$ gem install ruby-vips
or include it in
On Windows, you'll need to set the
RUBY_DLL_PATH environment variable to
point to the libvips bin directory.
require "vips" im = Vips::Image.new_from_file filename # put im at position (100, 100) in a 3000 x 3000 pixel image, # make the other pixels in the image by mirroring im up / down / # left / right, see # https://libvips.github.io/libvips/API/current/libvips-conversion.html#vips-embed im = im.embed 100, 100, 3000, 3000, extend: :mirror # multiply the green (middle) band by 2, leave the other two alone im *= [1, 2, 1] # make an image from an array constant, convolve with it mask = Vips::Image.new_from_array [ [-1, -1, -1], [-1, 16, -1], [-1, -1, -1]], 8 im = im.conv mask, precision: :integer # finally, write the result back to a file on disk im.write_to_file output_filename
Vips section in the docs for a tutorial introduction with
The libvips reference manual has a complete explanation of every method.
directory has some simple example programs.
The benchmark at vips-benchmarks loads a large image, crops, shrinks, sharpens and saves again, and repeats 10 times.
real time in seconds, fastest of five runs benchmark tiff jpeg ruby-vips.rb 0.85 0.78 image-magick 2.03 2.44 rmagick.rb 3.87 3.89 peak memory use in kb benchmark peak RES ruby-vips.rb 43864 rmagick.rb 788768
*Note that all licence references and agreements mentioned in the ruby-vips README section above are relevant to that project's source code only.