Skip to content
Wrapper for SVG Transcoding using Apache Batik
Ruby
Latest commit e0ac34d Nov 29, 2012 @kreynolds Merge pull request #1 from rykov/master
Allow the option to specify the document URI
Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
README.rdoc
Rakefile
ruby-batik.gemspec

README.rdoc

Batik

Batik (xmlgraphics.apache.org/batik/) is a Java-based toolkit for applications or applets that want to use images in the Scalable Vector Graphics (SVG) format for various purposes, such as display, generation or manipulation.

Quick Start

Be sure to add your batik installation to the classpath.

Rasterization

# Create a transcoder
transcoder = Batik::Transcoder.new

# Transcode an svg string to a string as a PNG
png = transcoder.to_png(svg_document)

# Transcode an svg string to a string as a JPEG
jpeg = transcoder.to_jpeg(svg_document)

# Transcode an svg string to a string as a PNG with some options
png = transcoder.to_png(svg_document, :dpi => 600, :indexed => 8)

# Transcode an svg string to a file
File.open('new.png', 'wb+') { |fp|
  fp.write(transcoder.to_png(svg_document))
}
Something went wrong with that request. Please try again.