Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2007

Tip: Looking for answers? Try searching our database.

Rotating images

Thread view: 
Francois Lionet - 09 May 2007 14:29 GMT
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 :-)



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.