Jump to content

QR code generator and reader


This topic is 3642 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi,

here is a small demo file that show how to generate QR codes and even read them from a container field.

http://www.bh-a.com/index.php?option=com_content&view=article&id=88&Itemid=84&lang=en

(requires ScriptMaster :laugh: )

Link to comment
Share on other sites

Brilliant stuff....

Thanks.

BUT

I transferred it to my Scriptmaster file and downloaded the latest zxing and it returns QR codes which are white on black

Any idea why??


import java.awt.image.BufferedImage

import com.google.zxing.qrcode.QRCodeWriter

import com.google.zxing.common.BitMatrix

import com.google.zxing.BarcodeFormat

import com.google.zxing.client.j2se.MatrixToImageWriter



mtx = new QRCodeWriter().encode (input, BarcodeFormat.QR_CODE, 500 , 500)

image = MatrixToImageWriter.toBufferedImage(mtx)

return image

  • Like 1
Link to comment
Share on other sites

Had to reverse the j2se method to make it work properly. Wierd


//import com.google.zxing.client.j2se.MatrixToImageWriter

 

 

int WHITE = 0xFFFFFF

writer =  new QRCodeWriter()

m = new QRCodeWriter().encode (input, BarcodeFormat.QR_CODE, w , h)

image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB)

for (x in 0..<w) {

for (y in 0..<h) {

   image.setRGB(x, y, m.get(x, y) ? WHITE : 0)

  } //end for

} //end for

Link to comment
Share on other sites

No, 10.6.8

It works if I fire up your file first and run the script from in there, but if I ran it at all from the SM demo file I keep it reversed and then affected your file until FM was restarted

Link to comment
Share on other sites

  • 1 year later...
  • 5 months later...
  • 3 months later...
  • 5 months later...

This topic is 3642 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.