Thursday, March 15, 2012

Gel button with mini_magick

"Gel Button" is also popular effect. And of course, mini_magick can do this effect.

require 'mini_magick'

image = MiniMagick::Image.open("http://duckduckgo.com/spread/spread4.png")
width = image[:width]
height = image[:height]
image.write 'spread4.png'

image_cloned = MiniMagick::Image.open('spread4.png')
image_cloned.combine_options do |mogrify|
  mogrify.alpha 'off'
  mogrify.blur "#{width}x#{height}"
  mogrify.shade "#{width}x#{height}"
  mogrify.normalize
  mogrify.sigmoidal_contrast '8,60%'
  mogrify.evaluate 'multiply', '.5'
  mogrify.roll "+0+#{(height*0.05).to_i}"
end
image_composed = image_cloned.composite(image) do |c|
  c.compose 'Screen'
end

image_composed.write 'gel_spread4.png'

This is the original image (from Duck Duck Go).

And, this is the converted one.

No comments:

Post a Comment