Sha256: aebc73567a7a3d2a6ac496f5e1b712eec8329b49a4c13628ccabae6f779fcb21

Contents?: true

Size: 813 Bytes

Versions: 15

Compression:

Stored size: 813 Bytes

Contents

#! /usr/local/bin/ruby -w
require 'RMagick'
require 'date'

# Demonstrate the Image#polaroid method

img = Magick::Image.read('images/Flower_Hat.jpg').first
img[:Caption] = "\nLosha\n" + Date.today.to_s

begin
    picture = img.polaroid do
      self.font_weight = Magick::NormalWeight
      self.font_style = Magick::NormalStyle
      self.gravity = Magick::CenterGravity
      self.border_color = "#f0f0f8"
    end

    # Composite it on a white background so the result is opaque.
    background = Magick::Image.new(picture.columns, picture.rows)
    result = background.composite(picture, Magick::CenterGravity, Magick::OverCompositeOp)

rescue NotImplementedError
    result = Magick::Image.read('images/notimplemented.gif').first
    result.resize!(img.columns, img.rows)
end


result.write('polaroid.jpg')

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
rmagick-2.13.4 doc/ex/polaroid.rb
rmagick-2.13.3 doc/ex/polaroid.rb
rmagick-2.13.3.rc1 doc/ex/polaroid.rb
rmagick-2.13.2 doc/ex/polaroid.rb
rdp-rmagick-0.0.0 doc/ex/polaroid.rb
rmagick-2.13.1 doc/ex/polaroid.rb
rmagick-2.12.2 doc/ex/polaroid.rb
rmagick-2.12.1 doc/ex/polaroid.rb
rmagick-2.12.0 doc/ex/polaroid.rb
rmagick-2.11.1 doc/ex/polaroid.rb
rmagick-2.10.0 doc/ex/polaroid.rb
rmagick-2.11.0 doc/ex/polaroid.rb
rmagick-2.9.0 doc/ex/polaroid.rb
rmagick-2.9.1 doc/ex/polaroid.rb
rmagick-2.9.2 doc/ex/polaroid.rb