Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ruby extension for the libvips image processing library.

License

NotificationsYou must be signed in to change notification settings

libvips/ruby-vips

Repository files navigation

Gem VersionTest

This gem is a Ruby binding for thelibvips image processinglibrary. It has been tested onLinux, macOS and Windows, and with ruby 2, ruby 3 and jruby. It usesruby-ffi to call functions in the libvipslibrary.

libvips is ademand-driven, horizontallythreadedimage processing library. Compared to similarlibraries,libvips runs quickly and uses littlememory.libvips is licensed under theLGPL2.1+.

Install on linux and macOS

Install the libvips binary with your package manager (eg.apt install libvips42 or perhapsbrew install vips, see thelibvips installinstructions) then installthis gem with:

gem install ruby-vips

Or includegem "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 includegem "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_filefilename# 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-embedim=im.embed100,100,3000,3000,extend::mirror# multiply the green (middle) band by 2, leave the other two aloneim *=[1,2,1]# make an image from an array constant, convolve with itmask=Vips::Image.new_from_array[[-1, -1, -1],[-1,16, -1],[-1, -1, -1]],8im=im.convmask,precision::integer# finally, write the result back to a file on diskim.write_to_fileoutput_filename

Documentation

There arefull API docs for ruby-vips onrubydoc. This sometimes has issuesupdating, so we have acopy on the gh-pages for this site aswell, whichshould always work.

See theVips section in the docs for atutorial introduction withexamples.

Thelibvips reference manualhas a complete explanation of every method.

Theexample/directory has some simple example programs.

Benchmarks

The benchmark atvips-benchmarksloads a large image, crops, shrinks, sharpens and saves again, and repeats10 times.

real time in seconds, fastest of five runsbenchmark       tiff    jpegruby-vips.rb0.850.78image-magick2.032.44rmagick.rb3.873.89peak memory use in kbbenchmarkpeak RESruby-vips.rb43864rmagick.rb788768

See alsobenchmarks at the official libvipswebsite.

About

Ruby extension for the libvips image processing library.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors29

Languages


[8]ページ先頭

©2009-2025 Movatter.jp