Scaling GIF images with transparent color should work fine. I agree with jarnbjo that the problem is most likely in generating a buffered generation.
Perhaps the following tips will help:
1) When creating the thumb, copy the type of image from the source, for example:
BufferedImage thumb = new BufferedImage(fit, fit, image.getType());
2) Use the 2D approach:
Graphics2D g = thumb.createGraphics();
Here is an example code for easy thumb creation (tested and working, GIF transparency inside, thumb keeping transparency):
public static BufferedImage thumb(BufferedImage image, int fit) { //image = blur(image); BufferedImage thumb = new BufferedImage(fit, fit, image.getType()); Graphics2D g = thumb.createGraphics(); try { int width = image.getWidth(); int height = image.getHeight(); int sx1; int sy1; int sx2; int sy2; int tmp; if (height > width) { tmp = height - width; sx1 = 0; sy1 = tmp / 2; sx2 = width; sy2 = height - sy1; } else if (width > height) { tmp = width - height; sx1 = tmp / 2; sy1 = 0; sx2 = width - sx1; sy2 = height; } else { sx1 = 0; sy1 = 0; sx2 = width; sy2 = height; } g.drawImage( image, 0, 0, fit, fit, sx1, sy1, sx2, sy2, null ); } finally { g.dispose(); } return thumb; }//thumb
Note: with a simple one, I mean that it will not produce high quality results if you try to scale too much in one step (for example, 2048 pixels, 100 pixels). You may need a multi-step approach, and probably you should contact AffineTransformOp for tips instead of using a graphics device.