解决Java处理png图片时透明背景变黑的问题

解决Java处理png图片时透明背景变黑的问题

解决Java处理png图片时透明背景变黑的问题

// Copy image to buffered image

Graphics2D g = bimage.createGraphics();

// 下面两行解决png透明图片会变黑的问题

bimage = g.getDeviceConfiguration().createCompatibleImage(image.getWidth(null), image.getHeight(null), Transparency.TRANSLUCENT);

g = bimage.createGraphics();

// Paint the image onto the buffered image

g.drawImage(image, 0, 0, null);

相关推荐

阴阳师雨女哪里多(雨女分布位置一览)
我和黑大佬的365天知乎

阴阳师雨女哪里多(雨女分布位置一览)

📅 07-04 👁️ 2549
比乐狗粮怎么样?一篇详尽的评测与指南
365bet体育365bet官网

比乐狗粮怎么样?一篇详尽的评测与指南

📅 08-16 👁️ 4043
四仰八叉的意思解释及典故(故事)
365bet手机app下载

四仰八叉的意思解释及典故(故事)

📅 07-04 👁️ 1893