Skip to content

Instantly share code, notes, and snippets.

@asaph
Created April 25, 2016 03:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save asaph/6ab76d086c711b4aa0840cfee4808c4d to your computer and use it in GitHub Desktop.
Save asaph/6ab76d086c711b4aa0840cfee4808c4d to your computer and use it in GitHub Desktop.
Create a QR Code PNG Image
public static void createQRCode(String barCodeData, String filePath, int height, int width)
throws WriterException, IOException {
BitMatrix matrix = new MultiFormatWriter().encode(barCodeData, BarcodeFormat.QR_CODE,
width, height);
try (FileOutputStream out = new FileOutputStream(filePath)) {
MatrixToImageWriter.writeToStream(matrix, "png", out);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment