Hi I have a problem.
I’m writing an app that would like to convert png images to jpg. It works fine
but transparent areas become gray, is there any possibility to make that gray
into white? I user the following code (I’m also rescaling the image). For some
reasons I must just Java 1.3.
Best reagards
Olle
imageData is byte[]
Image inImage = new ImageIcon(imageData).getImage();
double scale = (double) maxDim / (double) inImage.getHeight(null);
int scaledW = (int) (scale * inImage.getWidth(null));
int scaledH = (int) (scale * inImage.getHeight(null));
BufferedImage outImage = new BufferedImage(scaledW,
scaledH,BufferedImage.TYPE_INT_RGB);
AffineTransform tx = new AffineTransform();
if (scale < 1.0d) {
tx.scale(scale, scale);
}
Graphics2D g2d = outImage.createGraphics();
g2d.drawImage(inImage, tx, null);
g2d.dispose();
OutputStream os = new FileOutputStream(thumb);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(os);
encoder.encode(outImage);
os.close();
[Message sent by forum member 'olle' (olle)]
http://forums.java.net/jive/thread.jspa?messageID=138687
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".