<commit_before># ruby-vips : A fast image processing extension for Ruby.

[![Build Status](https://secure.travis-ci.org/jcupitt/ruby-vips.png)](http://travis-ci.org/jcupitt/ruby-vips)

ruby-vips is a ruby extension for [vips](http://www.vips.ecs.soton.ac.uk). 
It is fast and it can process images without requiring the 
entire image to be loaded into memory. For example, the benchmark at 
[vips-benchmarks](https://github.com/stanislaw/vips-benchmarks) loads a large
image, crops, shrinks, sharpens and saves again:

```text
real time in seconds, fastest of three runs
benchmark       tiff    jpeg
ruby-vips.rb    0.45    0.56    
rmagick.rb      1.69    1.90    
netpbm.sh       1.74    1.63    
image-magick.sh 2.87    3.02    
image_sci.rb    3.19    2.90    

peak memory use in kilobytes
benchmark       peak RSS
ruby-vips.rb    160400
image_sci.rb    546992
rmagick.rb      1370064
```

See also [benchmarks at the official libvips
website](http://www.vips.ecs.soton.ac.uk/index.php?title=Speed_and_Memory_Use).
There's a handy blog post explaining [how libvips opens
files](http://libvips.blogspot.co.uk/2012/06/how-libvips-opens-file.html)
which gives some more background.

ruby-vips allows you to set up pipelines that don't get executed until you
output the image to disk or to a string. This means you can create,
manipulate, and pass around Image objects without incurring any memory or CPU
costs. The image is not actually processed until you write the image to memory
or to disk.

*note*: ruby-vips will work with versions of libvips as far back as 7.12, but
with missing features and with reduced performance. For best results, use the 
latest libvips you can.

## Requirements.

  * OS X or Linux
  * MRI 1.8.7, 1.9.3
  * libvips 7.24 and later (it will work with earlier libvips, but some
    features may not be functional)

## Installation.

### Ubuntu Prerequisites.

```bash
$ apt-get install libvips-dev
```

### OS X Prerequisites.

```bash
$ brew tap homebrew/science
$ brew install vips
```

This will give you a very bare-bones vips, missing things like imagemagick
loading, openslide support, FFTs, and so on. To get a list of all the optional
dependencies, try:

```bash
$ brew info vips
```

For a full-fat version, try:

```bash
$ brew install vips --with-cfitsio --with-fftw --with-imagemagick \
    --with-libexif --with-liboil --with-libtiff --with-little-cms \
    --with-openexr --with-openslide --with-pango
```

If you want to build things outside homebrew which depend on vips,
such as ruby-vips, your pkg-config will need to be working. You
need to point pkg-config at the homebrew area, and, additionally, at
homebrew's libxml2 area:

In your .profile, add something like:

```bash
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig
```

To verify that your vips install is correct and working, try:

```bash
$ vips --version
vips-7.32.1-Mon May 20 10:01:38 BST 2013
```

To verrify that your pkg-config is working correctly with vips, try:

```bash
$ pkg-config vips --libs
-L/usr/local/Cellar/vips/7.32.1/lib ... a lot of stuff
```

TODO: Describe & test with macports.

### Other platforms

See [Installation on various
platforms](https://github.com/jcupitt/ruby-vips/wiki/installation-on-various-platforms).<commit_msg>README updates<commit_after># ruby-vips : A fast image processing extension for Ruby.

[![Build Status](https://secure.travis-ci.org/jcupitt/ruby-vips.png)](http://travis-ci.org/jcupitt/ruby-vips)

ruby-vips is a ruby extension for [vips](http://www.vips.ecs.soton.ac.uk). 
It is fast and it can process images without requiring the 
entire image to be loaded into memory. For example, the benchmark at 
[vips-benchmarks](https://github.com/stanislaw/vips-benchmarks) loads a large
image, crops, shrinks, sharpens and saves again:

```text
real time in seconds, fastest of three runs
benchmark       tiff    jpeg
ruby-vips.rb    0.45    0.56    
rmagick.rb      1.69    1.90    
netpbm.sh       1.74    1.63    
image-magick.sh 2.87    3.02    
image_sci.rb    3.19    2.90    

peak memory use in kilobytes
benchmark       peak RSS
ruby-vips.rb    160400
image_sci.rb    546992
rmagick.rb      1370064
```

See also [benchmarks at the official libvips
website](http://www.vips.ecs.soton.ac.uk/index.php?title=Speed_and_Memory_Use).
There's a handy blog post explaining [how libvips opens
files](http://libvips.blogspot.co.uk/2012/06/how-libvips-opens-file.html)
which gives some more background.

ruby-vips allows you to set up pipelines that don't get executed until you
output the image to disk or to a string. This means you can create,
manipulate, and pass around Image objects without incurring any memory or CPU
costs. The image is not actually processed until you write the image to memory
or to disk.

*note*: ruby-vips will work with versions of libvips as far back as 7.12, but
with missing features and with reduced performance. For best results, use the 
latest libvips you can.

## Requirements.

  * OS X or Linux
  * MRI 1.8.7, 1.9.3
  * libvips 7.24 and later (it will work with earlier libvips, but some
    features may not be functional)

## Installation.

### Ubuntu Prerequisites.

```bash
$ apt-get install libvips-dev
```

### OS X Prerequisites.

```bash
$ brew tap homebrew/science
$ brew install vips
```

Unfortunately homebrew/science is having some problem updating at the moment, you may find
this gives you a rather old libvips. See [the notes
here](http://www.vips.ecs.soton.ac.uk/index.php?title=Build_on_OS_X) for
possible work-arounds. 

This will give you a very bare-bones vips, missing things like imagemagick
loading, openslide support, FFTs, and so on. To get a list of all the optional
dependencies, try:

```bash
$ brew info vips
```

For a full-fat version, try:

```bash
$ brew install vips --with-cfitsio --with-fftw --with-imagemagick \
    --with-libexif --with-liboil --with-libtiff --with-little-cms \
    --with-openexr --with-openslide --with-pango
```

If you want to build things outside homebrew which depend on vips,
such as ruby-vips, your pkg-config will need to be working. You
need to point pkg-config at the homebrew area, and, additionally, at
homebrew's libxml2 area:

In your .profile, add something like:

```bash
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig
```

To verify that your vips install is correct and working, try:

```bash
$ vips --version
vips-7.36.4-Tue Nov 19 12:22:47 GMT 2013
```

To verify that your pkg-config is working correctly with vips, try:

```bash
$ pkg-config vips --libs
-L/usr/local/Cellar/vips/7.36.4/lib ... a lot of stuff
```

TODO: Describe & test with macports.

### Other platforms

See [Installation on various
platforms](https://github.com/jcupitt/ruby-vips/wiki/installation-on-various-platforms).
{'fraction_non_alphanumeric': 0.1039321736588218, 'fraction_numerical': 0.026019587779564392, 'mean_word_length': 3.5251322751322753, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 5, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2509403', 'n_tokens_mistral': 2484, 'n_tokens_neox': 2259, 'n_words': 815}