aspose file tools*
The moose likes Beginning Java and the fly likes Image Rotation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Image Rotation" Watch "Image Rotation" New topic
Author

Image Rotation

Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Hi

I used the below code to rotate the images. But this is not supporting TIFF formats. I heard that JAI will be used for rotating TIFF images. Could some advice how to download JAI jar and any samples to rotate



Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41905
    
  63
You mean you can't *store* the image as TIFF. Rotating an image in memory is independent of the format in which it will be stored later (if it's even going to be stored).

You don't need JAI, you need TIFF support for ImageIO. That is provided by the Java Advanced Imaging Image I/O Tools.

By the way, storing an image in BMP format with a JPG file extension is rather strange.


Ping & DNS - my free Android networking tools app
Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Thanks Ulf,

I tried with the below code and its rotating the image and saving it as out file but still am getting the exception



I my client machine in UNIX and I dont want to install the native lib. Please advice to override this error

Meet Gaurav
Ranch Hand

Joined: Oct 08, 2008
Posts: 492
Getting strange warning about not loading mediaLib

In case you see a warning message like the following when running your application:

Error: Could not load mediaLib accelerator wrapper classes. Continuing in pure Java mode.

Occurs in: com.sun.media.jai.mlib.MediaLibAccessorcom.sun.media.jai.mlib.MediaLibLoadException

This means that you did not install properly the native libraries and then JAI is working in pure JAVA mode.


Forcing Pure-Java mode

JAI can be run without its native acceleration layer without loss of functionality. This may be accomplished by setting the JVM switch com.sun.media.jai.disableMediaLib to true, which means starting the JVM adding the following parameters:

-Dcom.sun.media.jai.disableMediaLib=true



Still my client is not accepting to chnage JVM settings. As a result this may cause some other issues. Please assit me with some other suggestions.
Brian Legg
Ranch Hand

Joined: Nov 07, 2008
Posts: 488
I thought JAI was Java Advanced Imaging?

SCJA
~Currently preparing for SCJP6
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41905
    
  63
JAI is just about dead. I'd advise to go with the original code, and then to use ImageIO for handling TIFFs.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Image Rotation