Tuesday, February 7, 2012

specular reflection with mini_magick (1)

"Specular Reflection" - a.k.a. "mirror effect" - is the most popular effect for image file to be good-looking. This effect consists of 4 operations.
  1. clone from original image and rotate it
  2. add transparency to cloned image
  3. combine original image and cloned one
  4. resize combined image
In this article, I introduce the operation of both (1) and (2) with referring ImageMagick's sample page and using mini_magick.

This ruby script is like below:
require 'mini_magick'

image_original = MiniMagick::Image.open("original.jpg")

image_cloned = image_original.clone

image_cloned.combine_options do |c|
  c.flip
  c.fill 'white' # set background color
  c.colorize '65%'
end

image_cloned.write "cloned_rotate_transparent.jpg"

You can change the argument(color name) of fill method depending on the background color where you want to put the image file onto. These are original image and rotated and transparent one.


(continue to phosphorescence: specular reflection with mini_magick (2))

4 comments:

JOIN US HERE said...

Hi there! I just want to offer you a huge thumbs up for the great information you have here on this post. I’ll be coming back to your website for more soon.

야설

VISIT US said...

This website is really a walk-through for every one of the details you wanted concerning this and also didn't know who to ask. Glimpse right here, and also you'll absolutely uncover it.

오피헌터

ENJOY HERE said...

I'm satisfied, I must claim. Truly seldom do I run into a blog that's both educative as well as enjoyable, and let me tell you, you have struck the nail on the head. Your concept is impressive; the issue is something that inadequate individuals are speaking smartly about. I am very happy that I came across this in my search for something relating to this.

마사지블루

BEST SITE said...

I was extremely pleased to find this page. I need to to thank you for ones time for this particularly fantastic read!! I definitely enjoyed every little bit of it and I have you book-marked to check out new information in your blog.

건마탑

Post a Comment