Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby wrapper for libtiff with FFI
branch: master

Add Tiff::Image#set_field! for manual fields

This delegates directly to the FFI bound set_field method, passing along
the user's arguments.

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.