谷歌二维码生成
来源:互联网 发布:淘宝商品迁徙 编辑:程序博客网 时间:2024/05/22 01:56
相关jar包下载
private static final int BLACK = 0xff000000; private static final int WHITE = 0xFFFFFFFF; public static void genGR(String website, HttpServletResponse response) throws WriterException, IOException { int width = 300; int height = 300; String format = "jpg"; Hashtable<EncodeHintType, String> hints = new Hashtable<EncodeHintType, String>(); //Hashtable hints = new Hashtable(); hints.put(EncodeHintType.CHARACTER_SET, "utf-8"); BitMatrix bm = new MultiFormatWriter().encode(website, BarcodeFormat.QR_CODE, width, height, hints); BufferedImage image = toImage(bm); ImageIO.write(image, format, response.getOutputStream()); //把二维码写到response的输出流 } private static BufferedImage toImage(BitMatrix bm) { int width = bm.getWidth(); int height = bm.getHeight(); BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); for(int x = 0;x < width; x++){ for(int y = 0; y < height; y++ ){ image.setRGB(x, y, bm.get(x, y) ? BLACK : WHITE); } } return image; }
阅读全文
0 0
- 谷歌二维码生成
- AS3使用谷歌API生成二维码
- 使用谷歌 zxing 生成、解析二维码
- 使用谷歌zxing生成二维码
- Java使用谷歌的zxing生成二维码Qrcode并解析提取二维码图片内容
- java二维码 生成二维码
- 生成二维码、识别二维码
- 扫描二维码+生成二维码
- 生成二维码、自定义二维码
- java生成二维码的代码(使用谷歌zxing)
- 生成二维码
- 二维码生成
- 二维码生成
- 生成二维码
- 二维码生成
- 二维码生成
- 生成二维码
- 二维码生成
- 慕课网编程练习:制作一个表格,显示班级的学生信息。
- YJCocoa Gem开源库
- 软件测试学习6-动态白盒测试
- 电话程控交换机安装经验
- mysql基础1
- 谷歌二维码生成
- oracle ASM错误Initializing the Oracle ASMLib driver:[FAILED]
- tensorflow中的激活函数
- 文章标题
- Golang之flage
- 每个新手程序员都会犯的5个错误
- 从微软和小米的转型之痛,解读DevOps落地的核心要点
- Spring AbstractRoutingDataSource实现读写分离的Web工程
- 机器学习之KNN算法python实现