package com.hanthink.newcertificateqrcode; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; import javax.imageio.ImageIO; public class Test { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Test test = new Test(); BufferedImage img = NewCertificateMessgeQRCode.getQRCode("http://fw.jisheyun.com/?openId=oN0rnvrVxA2aJZZYmct-ZD9m_hQc&loginType=d", 20, 'H', 100); try { OutputStream out = new FileOutputStream(new File("d:/2.jpg")); ImageIO.write(img, "jpg", out); //将图片写入指定文件 } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
https://blog.csdn.net/xufenglai123/article/details/81316451