[magick-users] displacement map question

Timothy Hunter cyclists at nc.rr.com
Tue Sep 12 17:12:04 CDT 2006


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.


More information about the Magick-users mailing list