用java读取png并转成jpg图片
主要有三个步骤: 读取png图片 填充背景色为白色 保存成jpg图片 import java . awt . * ; import java . awt . image . BufferedImage ; import java . awt . image . Raster ; import java . net . URL ; import java . io . File ; import javax . imageio . ImageIO ; public static void main ( String [ ] args ) { try { //1.读取本地png图片or读取url图片 File input = new File ( "/Users/wuxinyue/XXamPFXa.png" ) ; BufferedImage bimg = ImageIO . read ( input ) ; //读取本地图片 //BufferedImage bimg = ImageIO.read(new URL("http://img.alicdn.com/tfs/TB1kbMoUOLaK1RjSZFxXXamPFXa.png"));//读取url图片 //2. 填充透明背景为白色 BufferedImage res = new BufferedImage ( bimg .