[magick-users] displacement map question

Timothy Hunter cyclists at nc.rr.com
Thu Sep 14 17:57:36 CDT 2006


On Sep 12, 2006, at 8:40 PM, Anthony Thyssen wrote:

> Timothy Hunter on  wrote...
> | I apologize up front if this post is vague. My last trig lessons  
> were
> | 35 years ago.
> |
> | I've been reading Anthony's examples on displacement maps.
> |
> | I'm working on an script that uses a displacement map to "bend" an
> | image, that is, to make the left side of the image curve inward and
> | the right side to curve outward, while leaving the top and bottom
> | straight and parallel. If I use a displacement map with a gradient
> | that changes linearly from black in the middle to gray50 on the top
> | and bottom, the image sides become v-shaped, not curved. (I hope  
> this
> | is clear.)
> |
> | Instead of changing linearly, the intensities in the gradient must
> | change on a curve, that curve being part of the perimeter of a  
> circle
> | having a specified radius. The radius of the circle defines how deep
> | the curves on the sides are.
> |
> | I have code that produces the displacement map using some simple  
> trig
> | functions to compute each intensity, but it seems to me that this
> | problem is probably already has a solution and I'm just ignorant of
> | it. Is there a function in ImageMagick that will produce such a
> | displacement map?
> |
> | If necessary I can produce the code (it's in Ruby) and the map I've
> | got now.
>
>
> Perhaps you can place some examples online, original, what you want,
> what you get, how you generate the displacement map.
>

After rather more messing about with my ISP than should be necessary  
(and scrounging a picture of a right triangle from the web), I've  
managed to upload a web page with the images, Ruby program, and some  
explanation. Check out http://home.nc.rr.com/foxhunter/polaroid.html.

The short version of my question is: is there a better, simpler way  
of producing the result of the displace operation?


More information about the Magick-users mailing list