b = image_name.createQRCode(qr_code_text,
ʃerrorCorrection := ecc,ʅ
ʃscale := scale,ʅ
ʃquietZone := quiet_zone,ʅ
ʃdarkColor := dark_color,ʅ
ʃlightColor := light_colorʅ);
The
Image.createQRCode function creates a
QR code and sets the contents of the
Image object to this image. The text for the QR code,
qr_code_text, can be specified using a string or numeric expression.
- errorCorrection := error correction level, specified as a string expression evaluating to one of four levels: "low" ‖ "medium" ‖ "quartile" ‖ "high". The higher the level, the larger the dimensions of QR code, as well as the increased likelihood that a partially corrupted QR code can be read. In addition to the words, the level can be specified using single letters: "L" ‖ "M" ‖ "Q" ‖ "H". (Default setting: medium.)
- scale := the number of pixels per "module," specified as a numeric expression. The value cannot be less than 1, and the higher the value, the larger the dimensions of the QR code. (Default setting: 4.)
- quietZone := the "quiet zone" (margin) around the QR code, specified as a numeric expression in "modules." The value cannot be less than 4. (Default setting: 4. Using the default scale and quiet zone results in a margin of 4 x 4 = 16 pixels.)
- darkColor := the color of the dark areas, specified as a string expression evaluating to a HTML color name (like "red") or a hex color code (like "#ff0000"). (Default: black.)
- lightColor := the color of the light areas, specified as a string expression. (Default: white.)
The dimensions of the created QR code image are not known prior to creation as they depend in part on the length of the input text, as well as the error correction level.
The function returns a logical value of 1 (
true) if the QR code was successfully generated, or 0 (
false) on error.
Image cspro_80_barcode;
cspro_80_barcode.createQRCode("Thanks for using CSPro 8.0!");
cspro_80_barcode.view();
Image csentry_apk_url;
csentry_apk_url.createQRCode("https://play.google.com/store/apps/details?id=gov.census.cspro.csentry",
errorCorrection := "quartile",
scale := 6,
quietZone := 8,
darkColor := "white",
lightColor := "green");
csentry_apk_url.view();