org.wamblee.utils
Class JpegUtils

java.lang.Object
  extended by org.wamblee.utils.JpegUtils

public class JpegUtils
extends java.lang.Object

Utility functions for processing JPEG images.

Author:
Erik Brakkee

Constructor Summary
JpegUtils()
           
 
Method Summary
static java.awt.image.BufferedImage loadJpegImage(java.io.InputStream aInput)
          Loads a jpeg image from an input stream.
static java.awt.image.BufferedImage scaleImage(int aMaxWidth, int aMaxHeight, java.awt.Image aImage)
          Scales an image preserving the aspect ratio.
static void writeJpegImage(java.io.OutputStream aOutput, int aQuality, java.awt.image.BufferedImage aThumbImage)
          Writes a JPEG image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JpegUtils

public JpegUtils()
Method Detail

scaleImage

public static java.awt.image.BufferedImage scaleImage(int aMaxWidth,
                                                      int aMaxHeight,
                                                      java.awt.Image aImage)
Scales an image preserving the aspect ratio.

Parameters:
aMaxWidth - Maximum width.
aMaxHeight - Maximum height.
aImage - Image to scale.
Returns:
Scaled image.

loadJpegImage

public static java.awt.image.BufferedImage loadJpegImage(java.io.InputStream aInput)
                                                  throws java.io.IOException,
                                                         java.lang.InterruptedException
Loads a jpeg image from an input stream.

Parameters:
aInput - Input stream.
Returns:
JPEG image.
Throws:
java.io.IOException - In case of IO problems.
java.lang.InterruptedException - When execution is interrupted.

writeJpegImage

public static void writeJpegImage(java.io.OutputStream aOutput,
                                  int aQuality,
                                  java.awt.image.BufferedImage aThumbImage)
                           throws java.io.IOException
Writes a JPEG image.

Parameters:
aOutput - Output stream to write to.
aQuality - Quality of the JPEG image in the range 0..100
aThumbImage -
Throws:
java.io.IOException


Copyright © 2010. All Rights Reserved.