More about reflection

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
wc2005
Posts: 6
Joined: 2011-04-26T01:44:31-07:00
Authentication code: 8675308

More about reflection

Post by wc2005 »

Hi, everybody! I love the reflection effect so much.
Please look at the screenshot here: http://img12.imageshack.us/my.php?image ... oncopy.png. Follow the instructions here http://www.imagemagick.org/Usage/advanced/#reflections, I can create a reflection like figure 1. Now I want a to create a reflection like figure 2 but I don't know how to do that, any suggestions? Thanks.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: More about reflection

Post by anthony »

Create the reflection as you did for image 1, the distort the result, as a single unit! Use SRT, Affine, or Perspective!

I mention this method in the reflection examples....
Just append the reflection to the source image first, then distort the source image as if it has no reflection attached, letting its reflection distort along with the main image...
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
wc2005
Posts: 6
Joined: 2011-04-26T01:44:31-07:00
Authentication code: 8675308

Re: More about reflection

Post by wc2005 »

Thanks so much for your precious reply!

Follow your instruction, we must distort the source image. But for this image (a .png file with a transparent background): http://img268.imageshack.us/my.php?imag ... ctiont.png, if we distort the source image, the result is wrong, I think. What can I do to have a right result in this case?

Many thanks!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: More about reflection

Post by anthony »

I can see your problem. Tricky. You basically can not just simply 'flip' the image.

You just need to use affine to create the reflection image that 'flips' along the line of the feet.

Look at the affine using arrows distortion example
http://www.imagemagick.org/Usage/distorts/#affine

For your image your control arrows goes from from the first foot to the second, The other arrow from the first foot straight up (any distance). that gives you your three points for affine distortion.

For reflection the upward arrow goes downward by the same length while the other 'ground' arrow does not change (only one control point changes). That will 'flip' the reflects correctly for that image.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
wc2005
Posts: 6
Joined: 2011-04-26T01:44:31-07:00
Authentication code: 8675308

Re: More about reflection

Post by wc2005 »

Thanks, Anthony!

I'm trying. I must say it takes me too long to define points for control arrows for an image and this is the problem. Unlike the other reflection types, I have to redefine points for each image for this reflection type. I have too many images, so I wonder if there is another way to achieve this? Thanks a lot!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: More about reflection

Post by anthony »

The other way would be to automate the selection of the 'fixed' control points.

Perhaps the 'best' fit of a sloped line to the image.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply