Hello,
I have an Image, and I would like to get the same image, rotated.
I know I have to use the AffineTransformOp class to do the job. But the
problem is that this class only works with Graphics2D. I cannot find a way
to transform an image directly.
So, in fact I should : a) create a BufferedImage from my Image (which is not
simple, I have to create a buffered image, then get the graphics2d then draw
the image in it), b) create an compatible dest bufferedimage using
affinetransformop.createcompatibleDestImage, c) get a graphics2d on this
image, d) perform the rotation in the graphics2d. Pfwew. Long winded road
isn't it? Isn't there a better way of doing this?
If anyone has a direct method, please tell me!
Thanks, Francois
Daniel Pitts - 09 May 2007 15:47 GMT
> Hello,
>
[quoted text clipped - 11 lines]
>
> Thanks, Francois
That doesn't sound to bad actually. You're question is a bit like.
"Is there a better way to paint a sun set. I need a canvas and some
paint to do it, but I can't find a way to get a sunset directly. So,
in fact I should: a) Buy a canvas and some paint at the art store. B)
Put the Canvas on my easel. c) spread my oils on my palette d) start
painting. "
Well, anyway, there is a more direct way.
Look at these three classes. You will need all three, if not more.
AffineTransformOp
BufferedImageFilter
and FilteredImageSource
Wojtek - 09 May 2007 16:44 GMT
Francois Lionet wrote :
> Hello,
>
[quoted text clipped - 9 lines]
> isn't it? Isn't there a better way of doing this?
> If anyone has a direct method, please tell me!
Or you can use a tool which someone else has created:
http://www.nsftools.com/tips/JavaTips.htm#jpgimage

Signature
Wojtek :-)