org.jim2mov.utils
Class MovieUtils

java.lang.Object
  extended by org.jim2mov.utils.MovieUtils

public abstract class MovieUtils
extends java.lang.Object

Utility class to help in the creation of some media classes.

Author:
andre

Constructor Summary
MovieUtils()
           
 
Method Summary
static byte[] bufferedImageToJPEG(java.awt.image.BufferedImage img, float quality)
          Converts a buffered image to a JPEG image
static byte[] convertImageToJPEG(java.io.File originalImage, float quality)
          converts an image to JPEG
static javax.media.MediaLocator createMediaLocator(java.lang.String url)
          Create a media locator from the given location.
static byte[] int32RGBBufferedImageToByteArray(java.awt.image.BufferedImage img)
          Converts a standard 32 bit/pixel RGB image into a byte array
static byte[] loadImageAs32bitRGB(java.io.File imageLoc)
          Tries to load an image as a 32 bit RGB image...
static byte[] loadImageFile(java.io.File imageLoc)
          Loads a file using the standard Java IO classes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MovieUtils

public MovieUtils()
Method Detail

createMediaLocator

public static javax.media.MediaLocator createMediaLocator(java.lang.String url)
Create a media locator from the given location.

Parameters:
url - The location of the place where the media will be writen.
Returns:
A media locator.

loadImageFile

public static byte[] loadImageFile(java.io.File imageLoc)
                            throws java.io.IOException
Loads a file using the standard Java IO classes

Parameters:
imageLoc - The location of the file
Returns:
A byte array with file information
Throws:
java.io.IOException - If some error occurs while reading the file

convertImageToJPEG

public static byte[] convertImageToJPEG(java.io.File originalImage,
                                        float quality)
                                 throws java.io.IOException
converts an image to JPEG

Parameters:
originalImage - The location of the image
quality - The quality of the jpeg output
Returns:
A byte array with the image as a JPEG
Throws:
java.io.IOException - If some error occurs while reading the image

loadImageAs32bitRGB

public static byte[] loadImageAs32bitRGB(java.io.File imageLoc)
                                  throws java.io.IOException
Tries to load an image as a 32 bit RGB image...

Parameters:
imageLoc - The location of the image
Returns:
The 32 bit image
Throws:
java.io.IOException - If some error occurs

bufferedImageToJPEG

public static byte[] bufferedImageToJPEG(java.awt.image.BufferedImage img,
                                         float quality)
                                  throws java.io.IOException
Converts a buffered image to a JPEG image

Parameters:
img - The image to convert
quality - The quality of the output
Returns:
The JPEG image as a byte array
Throws:
java.io.IOException - If some IO error occurs

int32RGBBufferedImageToByteArray

public static byte[] int32RGBBufferedImageToByteArray(java.awt.image.BufferedImage img)
Converts a standard 32 bit/pixel RGB image into a byte array

Parameters:
img - The image to convert
Returns:
A byte array with the image