Image perspective transformation

How do I transform the following image:

http://www.private.is/arni/before.gif

to this image:

http://www.private.is/arni/after.gif

Unfortunately the transformation you want is not affine (i.e. doesn’t conserve parallel lines), and therefore cannot be implemented by means of an AffineTransform.

A quick hack would be to manually rescale and redraw each horizontal line, by drawing 1-pixel-tall parts of the original image into 1-pixel-tall (but not so wide) parts of the new image, but this won’t do if the operation is performance sensitive.

Oh, there are probably lots of libraries which will do the transform, or maybe something I don’t know about in java2d.

The JAI extension can do this, unfortunately they didn’t include it in the standard JRE (would have been great to create small 3D games with basic texturing).

Lilian

Thanks, appearently I’ll be bumping this as I’ve found other ways to do things. :slight_smile: thanks anyway.