int widthStretch = requestedWidth - extraWidth; int heightStretch = requestedHeight - extraHeight; int imageType = ImageUtils.isOpaque(image) ? BufferedImage.TYPE_3BYTE_BGR : BufferedImage.TYPE_INT_ARGB; image = ImageUtils.getScaledInstance(image, widthStretch, heightStretch, VALUE_INTERPOLATION_BICUBIC, true /* higherQuality */, imageType);
@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 bufferedImage) throws IOException { BufferedImage palettized = ImageUtils.palettize(bufferedImage, config.getMaxPaletteSize()); if (palettized != null) { write(palettized); BufferedImage depalettized = ImageUtils.depalettize(bufferedImage, config.getMaxInMemoryBytes()); if (depalettized != null) { isOpaque = bufferedImage.getColorModel().getTransparency() == ColorModel.OPAQUE; } else { isOpaque = ImageUtils.isOpaque(bufferedImage);
@Override protected void rewriteImpl(BufferedImage bufferedImage) throws IOException { BufferedImage palettized = ImageUtils.palettize(bufferedImage, config.getMaxPaletteSize()); if (palettized != null) { write(palettized); BufferedImage depalettized = ImageUtils.depalettize(bufferedImage, config.getMaxInMemoryBytes()); if (depalettized != null) { isOpaque = bufferedImage.getColorModel().getTransparency() == ColorModel.OPAQUE; } else { isOpaque = ImageUtils.isOpaque(bufferedImage);
@Override protected void rewriteImpl(BufferedImage bufferedImage) throws IOException { BufferedImage palettized = ImageUtils.palettize(bufferedImage, config.getMaxPaletteSize()); if (palettized != null) { write(palettized); BufferedImage depalettized = ImageUtils.depalettize(bufferedImage, config.getMaxInMemoryBytes()); if (depalettized != null) { isOpaque = bufferedImage.getColorModel().getTransparency() == ColorModel.OPAQUE; } else { isOpaque = ImageUtils.isOpaque(bufferedImage);
@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); } }
int widthStretch = requestedWidth - extraWidth; int heightStretch = requestedHeight - extraHeight; int imageType = ImageUtils.isOpaque(image) ? BufferedImage.TYPE_3BYTE_BGR : BufferedImage.TYPE_INT_ARGB; image = ImageUtils.getScaledInstance(image, widthStretch, heightStretch, VALUE_INTERPOLATION_BICUBIC, true /* higherQuality */, imageType);
@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); } }
int widthStretch = requestedWidth - extraWidth; int heightStretch = requestedHeight - extraHeight; int imageType = ImageUtils.isOpaque(image) ? BufferedImage.TYPE_3BYTE_BGR : BufferedImage.TYPE_INT_ARGB; image = ImageUtils.getScaledInstance(image, widthStretch, heightStretch, VALUE_INTERPOLATION_BICUBIC, true /* higherQuality */, imageType);