[Image-SIG] Question about transform(size, PERSPECTIVE, data)

Kent Tenney ktenney at gmail.com
Sat Jun 16 16:01:57 CEST 2007


Starting with a 100 x 20 image,
I want to produce a trapezoid with corners at
top left = 20,0 top right = 80,0 bottom left = 0,20 bottom right = 100,20

the image now has a 45 degree bevel at the ends.

I've found that the data param to transform PERSPECTIVE, a,b,c,d,e,f,g,h

 (a x + b y + c)/(g x + h y + 1), (d x + e y + f)/(g x + h y + 1)

I don't have the math skills to solve for the result I need.

Any help is greatly appreciated.


PS Why?

I want to place an image within a larger image, with
the smaller in a frame which blends between the two.

This seamless embedding is quite a nice effect.

The perspective effect is to miter the edges of the frame.
At one time I implemented a crude version which just
cropped the blended elements to 45 degree, now I want
to revisit doing a proper transform.

More information about the Image-SIG mailing list