简体   繁体   中英

distorted color of images in java swing gui

I have for example the following picture displayed in my gui:

http://www.zielpunkt.at/image/produkte/1354097303-airwick.jpg

Unfortunately the colors are distorted (pink background):

My code:

URL pictureURL = new URL(product.getBild()); 
            BufferedImage myPicture = ImageIO.read(pictureURL);
            JLabel picLabel = new JLabel(new ImageIcon( myPicture ));
            c.fill = GridBagConstraints.HORIZONTAL;
            c.gridwidth = 2;
            c.gridx = 0;
            c.gridy = 5;
            panel.add(picLabel,c);

Looking forwart to your answers! Regards,

截图

Most of my images look like this, but when I look at the graphic on the url it looks normal.

As noted here , the "pinkish tint" may be due to misinterpreted transparency information. As shown here , "one simple expedient is to render the image" into a compatible BufferedImage .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM