Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Ruby wrapper for libtiff with FFI

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 Gemfile
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 SPEC.md
Octocat-spinner-32 tiff.gemspec
README.md

Tiff

This is a simple wrapper around libtiff using FFI. It only implements a small subset of libffi's features -- just enough to generate a TIFF image and read back some of its data. If you're interested in adding features, you can always send me a pull request (please include specs!).

Usage

Tiff::Image.open "filename.tif", "w" do |tiff|

  tiff.set_field :compression, :CCITTFAX4
  # or: tiff.set_field :compression, :CCITTFAX3

  tiff.set_field :photometric, :min_is_white
  # or: tiff.set_field :photometric, :min_is_black

  tiff.bits_per_sample = 1
  tiff.width = 200
  tiff.height = 40

  tiff.data = raw_data

end

image = Tiff::Image.open "filename.tif", "r"
image.get_field :width  # => 200
image.get_field :height # => 40
Something went wrong with that request. Please try again.