Shutterbug
A rack utility that will create and save images (pngs) from parts of your html's documents current dom. These images become available as public png resources in the rack application. Currently shutterbug supports HTML, SVG and Canvas elements.
use Shutterbug::Rackapp
Installation
Add this line to your application's Gemfile:
gem 'shutterbug'
And then execute:
$ bundle
Or install it yourself as:
$ gem install shutterbug
License
- Simplified BSD,
- MIT, or
- Apache 2.0.
See License.txt for more information.
Usage
After adding use Shutterbug::Rackapp to your config.ru file, you can convert pieces of your web-page into png images. Just follow these steps:
- include the following javascript in your pages:
<script src='http://<yourhost:port>/shutterbug/shutterbug.js' type='text/javascript'></script> - Elsewhere in your javascript call
getDomSnapshot($("#sourceDomID"),$("#imageOutputDomId"));This will replace the contents of$("#imageOutputDomId")with an<img src="http://<yourhost:port>/gete_png/sha1hash>tag which will magically spring into existance.
TODO:
- Configuration of the rack paths.
- Fix web-font bugs in phantom js.
- Better abstraction phantomjs command line invocation. Use phantomjs.rb ?
- Use sprockets for and coffee.erb for shutterbug.js
- Write Tests.
- Write Documentation.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
© 2013 The concord Consortium.

