com.bbn.openmap.image
Class JPEGHelper

java.lang.Object
  extended by com.bbn.openmap.image.JPEGHelper

public class JPEGHelper
extends java.lang.Object

This class provides some utility methods for creating jpeg encoded images. It relies on the Sun JDK/SDK JPEG codec classes.


Method Summary
static byte[] encodeJPEG(java.awt.image.BufferedImage image, float quality)
          Return a byte array that contains the JPEG encoded image.
static byte[] encodeJPEG(int w, int h, int[] pixels, float quality)
          Return a byte array that contains the JPEG encoded image.
static void main(java.lang.String[] args)
          A test main that encodes an image url at various jpeg quality factors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encodeJPEG

public static byte[] encodeJPEG(java.awt.image.BufferedImage image,
                                float quality)
                         throws java.io.IOException
Return a byte array that contains the JPEG encoded image.

Parameters:
image - the image to encode
quality - the JPEG quality factor to use in encoding
Throws:
java.io.IOException - an error occurred in encoding the image

encodeJPEG

public static byte[] encodeJPEG(int w,
                                int h,
                                int[] pixels,
                                float quality)
                         throws java.io.IOException
Return a byte array that contains the JPEG encoded image.

Parameters:
w - the width of the image
h - the height of the image
pixels - the array of pixels in RGB directcolor
quality - the JPEG quality factor to use in encoding
Throws:
java.io.IOException - an error occurred in encoding the image

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
A test main that encodes an image url at various jpeg quality factors.

Parameters:
args - url [width height]
Throws:
java.lang.Exception


Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details