org.apache.shindig.gadgets.rewrite.image
Class GIFOptimizer

java.lang.Object
  extended by org.apache.shindig.gadgets.rewrite.image.GIFOptimizer

public class GIFOptimizer
extends Object

Optimize GIF images by converting them to PNGs or even JPEGs depending on content


Nested Class Summary
static class BaseOptimizer.ImageIOOutputter
          Standard ImageIO based image outputter
static interface BaseOptimizer.ImageOutputter
          Interface to allow for different serialization libraries to be used
static class BaseOptimizer.SanselanOutputter
          Sanselan based image outputter
 
Field Summary
protected  byte[] minBytes
           
protected  int minLength
           
protected  BaseOptimizer.ImageOutputter outputter
           
 
Constructor Summary
GIFOptimizer(OptimizerConfig config, HttpResponseBuilder response)
           
 
Method Summary
protected  String getOriginalContentType()
           
protected  String getOriginalFormatName()
           
protected  String getOutputContentType()
           
protected  BaseOptimizer.ImageOutputter getOutputter()
           
protected  byte[] getRewrittenImage()
          Get the rewritten image if available
static BufferedImage readGif(InputStream is)
           
static BufferedImage readPng(InputStream is)
           
 void rewrite(BufferedImage image)
           
protected  void rewriteImpl(BufferedImage image)
           
protected  void write(BufferedImage image)
          Write the image using a specified write param
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputter

protected BaseOptimizer.ImageOutputter outputter

minBytes

protected byte[] minBytes

minLength

protected int minLength
Constructor Detail

GIFOptimizer

public GIFOptimizer(OptimizerConfig config,
                    HttpResponseBuilder response)
Method Detail

readGif

public static BufferedImage readGif(InputStream is)
                             throws org.apache.sanselan.ImageReadException,
                                    IOException
Throws:
org.apache.sanselan.ImageReadException
IOException

rewriteImpl

protected void rewriteImpl(BufferedImage image)
                    throws IOException
Throws:
IOException

getOriginalContentType

protected String getOriginalContentType()

getOutputContentType

protected String getOutputContentType()

getOriginalFormatName

protected String getOriginalFormatName()

readPng

public static BufferedImage readPng(InputStream is)
                             throws org.apache.sanselan.ImageReadException,
                                    IOException
Throws:
org.apache.sanselan.ImageReadException
IOException

getOutputter

protected BaseOptimizer.ImageOutputter getOutputter()

write

protected void write(BufferedImage image)
              throws IOException
Write the image using a specified write param

Throws:
IOException

rewrite

public void rewrite(BufferedImage image)
             throws IOException
Throws:
IOException

getRewrittenImage

protected final byte[] getRewrittenImage()
Get the rewritten image if available



Copyright © 2007-2012. All Rights Reserved.