ProductPromotion
Logo

Ruby

made by https://0x3d.site

GitHub - libvips/ruby-vips: Ruby extension for the libvips image processing library.
Ruby extension for the libvips image processing library. - libvips/ruby-vips
Visit Site

GitHub - libvips/ruby-vips: Ruby extension for the libvips image processing library.

GitHub - libvips/ruby-vips: Ruby extension for the libvips image processing library.

ruby-vips

Gem Version Test

This gem is a Ruby binding for the libvips image processing library. It has been tested on Linux, macOS and Windows, and with ruby 2, ruby 3 and jruby. It uses ruby-ffi to call functions in the libvips library.

libvips is a demand-driven, horizontally threaded image processing library. Compared to similar libraries, libvips runs quickly and uses little memory. libvips is licensed under the LGPL 2.1+.

Install on linux and macOS

Install the libvips binary with your package manager (eg. apt install libvips42 or perhaps brew install vips, see the libvips install instructions) then install this gem with:

gem install ruby-vips

Or include gem "ruby-vips" in your gemfile.

Install on Windows

The gemspec will pull in the msys libvips for you, so all you need is:

gem install ruby-vips

Or include gem "ruby-vips" in your gemfile.

Tested with the ruby and msys from choco, but others may work.

Example

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

Documentation

There are full API docs for ruby-vips on rubydoc. This sometimes has issues updating, so we have a copy on the gh-pages for this site as well, which should always work.

See the Vips section in the docs for a tutorial introduction with examples.

The libvips reference manual has a complete explanation of every method.

The example/ directory has some simple example programs.

Benchmarks

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

See also benchmarks at the official libvips website.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory