在当今数字化时代,二维码已经成为我们生活中不可或缺的一部分。从商店的支付方式到产品的追溯系统,二维码的应用无处不在。那么,二维码究竟是什么?它是如何工作的?它的未来又将走向何方?今天,我们就来一探究竟。
一、二维码的起源与发展
二维码(Quick Response Code,简称QR Code)最早于1994年由日本的Denso Wave公司发明。最初,二维码被设计用于追踪汽车零部件的生产过程。与传统的一维条形码相比,二维码能够存储更多的信息,因为它是以矩阵形式排列的黑白方块。
2025年03月29日
在当今数字化时代,二维码已经成为我们生活中不可或缺的一部分。从商店的支付方式到产品的追溯系统,二维码的应用无处不在。那么,二维码究竟是什么?它是如何工作的?它的未来又将走向何方?今天,我们就来一探究竟。
一、二维码的起源与发展
二维码(Quick Response Code,简称QR Code)最早于1994年由日本的Denso Wave公司发明。最初,二维码被设计用于追踪汽车零部件的生产过程。与传统的一维条形码相比,二维码能够存储更多的信息,因为它是以矩阵形式排列的黑白方块。
2025年03月29日
今天介绍一下golang第三方库:tuotoo/qrcode ,支持生成二维码和解码二维码图片。以下是使用 tuotoo/qrcode 进行二维码识别(解码)的详细教程:
2025年03月29日
qrencode 是一个用于生成二维码的命令行工具。它可以将文本、URL、电话号码等信息转换为二维码图像。生成的二维码图像可以保存为图片文件,方便在电子文档、网页、移动应用等各种场景中使用。 它支持的二维码是 QR 码,具有信息容量大、可靠性高、可表示汉字及图象等多种文字信息、保密防伪性强等优点,是目前较为常用的二维条码。
2024年08月06日
关于二维码,之前有简单提过“包容万物”的 草料二维码 https://cli.im/
草料二维码可以将文本、网址、文件、图片、音视频等内容,储存在小小的二维码中,并且在不改变二维码图案的前提下,可以随时更改存储的内容。
那么二维码为什么可以“存储”那么多的内容?又为什么可以随时更改呢?先来了解一些基础知识吧~
2024年08月06日
二维码在线生成器哪些比较好用?
随着数字化时代的到来,二维码已经成为人们日常生活中必不可少的一部分。它可以用于信息传递、商品销售、用户身份验证等多种场景,因此,二维码在线生成器也变得越来越受欢迎。
2024年08月06日
有时候我们经常会想要实现二维码批量生成的功能,这里提供一个二维码生成以及解析的工具类,包括可以上传logo,代码如下:
/**
* 二维码工具类
* @date 20198年10月31日
* @version 1.0
*/
public class QRCodeUtils {
// 二维码大小
private static final int QRCODE_SIZE = 300;
// 二维码中间logo的尺寸
private static final int WIDTH = 60;
private static final int HEIGHT = 60;
public static void encode(String content, String logoPath, String imgPath) throws Exception {
encode(content, logoPath, imgPath, QRCODE_SIZE, 1);
}
public static void encode(String content, String logoPath, String imgPath, int size, int margin) throws Exception {
BufferedImage image = createImage(content, logoPath, size, margin);
ImageIO.write(image, "png", new File(imgPath));
}
public static void encode(String content, String logoPath, OutputStream output) throws Exception {
encode(content, logoPath, output, QRCODE_SIZE, 1);
}
public static void encode(String content, String logoPath, OutputStream output, int size, int margin) throws Exception {
BufferedImage image = createImage(content, logoPath, size, margin);
ImageIO.write(image, "png", output);
}
private static BufferedImage createImage(String content, String imgPath, int size, int margin) throws Exception {
Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
hints.put(EncodeHintType.MARGIN, margin);
BitMatrix bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, size, size, hints);
int[] rec = bitMatrix.getEnclosingRectangle();
int resWidth = rec[2] + 1;
int resHeight = rec[3] + 1;
BitMatrix resMatrix = new BitMatrix(resWidth, resHeight);
resMatrix.clear();
for (int i = 0; i < resWidth; i++) {
for (int j = 0; j < resHeight; j++) {
if (bitMatrix.get(i + rec[0], j + rec[1])) {
resMatrix.set(i, j);
}
}
}
int width = bitMatrix.getWidth();
int height = bitMatrix.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, bitMatrix.get(x, y) ? 0xFF000000 : 0xFFFFFFFF);
}
}
if (imgPath == null || "".equals(imgPath)) {
return image;
}
// 插入图片
insertImage(image, imgPath, size);
return image;
}
private static void insertImage(BufferedImage source, String imgPath, int size) throws Exception {
File file = new File(imgPath);
if (!file.exists()) {
System.out.println(""+imgPath+" 该文件不存在!");
return;
}
Image src = ImageIO.read(new File(imgPath));
int width = src.getWidth(null);
int height = src.getHeight(null);
// 压缩LOGO
if (width > WIDTH) {
width = WIDTH;
}
if (height > HEIGHT) {
height = HEIGHT;
}
Image image = src.getScaledInstance(width, height, Image.SCALE_SMOOTH);
BufferedImage tag = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics g = tag.getGraphics();
g.drawImage(image, 0, 0, null); // 绘制缩小后的图
g.dispose();
src = image;
// 插入LOGO
Graphics2D graph = source.createGraphics();
int x = (size - width) / 2;
int y = (size - height) / 2;
graph.drawImage(src, x, y, width, height, null);
Shape shape = new RoundRectangle2D.Float(x, y, width, width, 6, 6);
graph.setStroke(new BasicStroke(3f));
graph.draw(shape);
graph.dispose();
}
public static String decode(File file) throws Exception {
BufferedImage image;
image = ImageIO.read(file);
if (image == null) {
return null;
}
BufferedImageLuminanceSource source = new BufferedImageLuminanceSource(image);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
Result result;
Hashtable<DecodeHintType, Object> hints = new Hashtable<DecodeHintType, Object>();
hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");
result = new MultiFormatReader().decode(bitmap, hints);
return result != null ? result.getText() : null;
}
public static void main(String[] args) throws Exception {
QRCodeUtils.encode("https://www.suibibk.com/blog/579412311547052032/582955445098905600/639208466002477056", "e:/logo.jpg", "e:/qrcode.png");
// 解析二维码存储的内容并打印
System.out.println(decode(new File("e:/qrcode.png")));
}
}
2024年08月06日
https://www.lskyf.com/post/51
下载地址
http://cj.lskyf.com/mhimpmpmffogbmmkmajibklelopddmjf.html
用户数:989,391 4.5星 推荐理由:没有跟踪,没有广告,没有别的邪恶。
2024年08月06日
2024年08月06日
二维码在线生成器如何使用?长连接转化成短连接如何实现
随着互联网的发展,人们使用网络的方式也越来越多样化。其中,二维码成为了人们连接网络的一种重要方式。下面,我们将介绍二维码在线生成器以及如何将长连接转化成短连接。
2024年08月06日
ZXing.NET 是一个开源的、功能强大的二维码处理库,它能够对二维码进行解码(读取信息)和编码(生成二维码)。ZXing 是 "Zebra Crossing" 的缩写,是一个跨平台的、用于解码和生成条形码和二维码的库。以下是一些 ZXing.Net 的主要功能通过实例讲解。