Thursday, March 23, 2023

QR Access: Simplify Your Entry Process with Java Code Implementation

import java.awt.image.BufferedImage;

import java.io.File;

import java.io.IOException;

import javax.imageio.ImageIO;

import com.google.zxing.BinaryBitmap;

import com.google.zxing.LuminanceSource;

import com.google.zxing.MultiFormatReader;

import com.google.zxing.NotFoundException;

import com.google.zxing.Result;

import com.google.zxing.client.j2se.BufferedImageLuminanceSource;

import com.google.zxing.common.HybridBinarizer;

public class QR_Code_Scan {

public static void main(String[] args) throws IOException, NotFoundException {

File file = new File("D:\\SURIYA\\my_web.png");

BufferedImage bufferedimage = ImageIO.read(file);

LuminanceSource luminanceSource = new BufferedImageLuminanceSource(bufferedimage);

BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(luminanceSource));

// To Extract information from QR code;

Result result = new MultiFormatReader().decode(binaryBitmap);

String decodedText = result.getText();

System.out.println(decodedText);

}

}

No comments:

Post a Comment