Skip to content

Instantly share code, notes, and snippets.

@tjstankus
Created June 21, 2010 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tjstankus/446754 to your computer and use it in GitHub Desktop.
Save tjstankus/446754 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'prawn'
require 'prawn/measurement_extensions'
require 'prawn/fast_png'
require 'RMagick'
image = Magick::Image.new(300,300) do
self.background_color = 'black'
self.depth = 8 # without this it breaks in Windows
self.format = 'PNG'
end
shadow = image.shadow
shadow_blob = shadow.to_blob
pdf = Prawn::Document.new
pdf.image(StringIO.new(shadow_blob))
pdf.render_file('shadow.pdf')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment