@Override protected void rewriteImpl(BufferedImage image) throws IOException { if (!ImageUtils.isOpaque(image)) { // We can rewrite transparent GIFs to PNG but for IE6 it requires the use of // the AlphaImageReader and some pain. Deferring this until that is proven to work // Write to strip any metadata and re-compute the palette. We allow arbitrary large palettes // here as if the image is already in a direct color model it will already have been // constrained by the max in-mem constraint. write(ImageUtils.palettize(image, Integer.MAX_VALUE)); } else { usePng = true; outputter = new ImageIOOutputter(ImageIO.getImageWritersByFormatName("png").next(), null); super.rewriteImpl(image); } }
@Override protected void rewriteImpl(BufferedImage image) throws IOException { if (!ImageUtils.isOpaque(image)) { // We can rewrite transparent GIFs to PNG but for IE6 it requires the use of // the AlphaImageReader and some pain. Deferring this until that is proven to work // Write to strip any metadata and re-compute the palette. We allow arbitrary large palettes // here as if the image is already in a direct color model it will already have been // constrained by the max in-mem constraint. write(ImageUtils.palettize(image, Integer.MAX_VALUE)); } else { usePng = true; outputter = new ImageIOOutputter(ImageIO.getImageWritersByFormatName("png").next(), null); super.rewriteImpl(image); } }
@Override protected void rewriteImpl(BufferedImage image) throws IOException { if (!ImageUtils.isOpaque(image)) { // We can rewrite transparent GIFs to PNG but for IE6 it requires the use of // the AlphaImageReader and some pain. Deferring this until that is proven to work // Write to strip any metadata and re-compute the palette. We allow arbitrary large palettes // here as if the image is already in a direct color model it will already have been // constrained by the max in-mem constraint. write(ImageUtils.palettize(image, Integer.MAX_VALUE)); } else { usePng = true; outputter = new ImageIOOutputter(ImageIO.getImageWritersByFormatName("png").next(), null); super.rewriteImpl(image); } }