Skip to content
Squeegy edited this page Sep 12, 2010 · 2 revisions

shadow(options = {})

Add a drop shadow to the image. This will increase the image size just enough to include the shadow

Use the following keys in the options hash:

  • :offset
    Distance of the drop shadow from the image. Positive numbers move it down and right, negative numbers move it up and left.
  • :blur
    How blurry the shadow is. Roughly corresponds to distance, in pixels, of the feathered shadow edge.
  • :background
    A color for the background of the image. What the shadow fades into.
  • :color
    Color of the shadow itself.
  • :opacity
    Opacity of the shadow. A value between 0.0 and 1.0, where 1.0 is opaque and 0.0 is transparent.

Example

@photo.operate do |image|
  # Default settings
  image.shadow(
    :color      => 'black',    # or color(0, 0, 0)
    :background => 'white',    # or color(255, 255, 255)
    :blur       => 8,
    :offset     => '2x2',
    :opacity    => 0.75 
  )

  # Huge red shadow on a black background
  image.shadow(
    :color      => color(255, 0, 0),
    :background => 'black',    # or color(255, 255, 255)
    :blur       => 30,
    :offset     => '20x10',
    :opacity    => 1
  )
end

Back to Operators

Clone this wiki locally