AutoIt Requires Chilkat v11.7.0+
AutoIt
QR Code Quiet Zone, Padding and Rotation
See more QR Code Examples
Demonstrates the space around a QR code and its rotation. The quiet zone is the blank margin a reader needs around the symbol. It is measured in modules, the QR standard requires 4, and QrCode will make it larger but not smaller. Padding is extra space outside the quiet zone, measured in the render units (pixels by default). Rotation turns the whole image by 90, 180 or 270 degrees. A QR code reads the same at any rotation.Chilkat AutoIt Downloads
Local $bSuccess = False
; This example requires the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
$oJson = ObjCreate("Chilkat.JsonObject")
$oJson.UpdateString("payload.text","https://www.chilkatsoft.com/")
$oJson.UpdateInt("render.moduleSize",6)
; A quiet zone of 6 modules on every side instead of the standard 4.
$oJson.UpdateInt("render.quietZone.left",6)
$oJson.UpdateInt("render.quietZone.top",6)
$oJson.UpdateInt("render.quietZone.right",6)
$oJson.UpdateInt("render.quietZone.bottom",6)
; 10 more pixels of background around that.
$oJson.UpdateInt("render.padding",10)
; Turn the image a quarter turn clockwise.
$oJson.UpdateInt("render.rotation",90)
$oJson.UpdateString("output.path","qa_output/qr_margins.png")
$oJson.UpdateBool("output.overwrite",True)
$oJson.UpdateString("output.return","none")
$oFmt = ObjCreate("Chilkat.Formats")
$oJsonOut = ObjCreate("Chilkat.JsonObject")
$bSuccess = $oFmt.QrCode("generate",$oJson,$oJsonOut)
If ($bSuccess = False) Then
ConsoleWrite($oFmt.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("module: " & $oJsonOut.IntOf("measurements[0].pitch") & " pixels" & @CRLF)
ConsoleWrite("symbol: " & $oJsonOut.IntOf("measurements[0].symbolWidth") & " x " & $oJsonOut.IntOf("measurements[0].symbolHeight") & " pixels at (" & $oJsonOut.IntOf("measurements[0].symbolX") _
& "," & $oJsonOut.IntOf("measurements[0].symbolY") & ")" & @CRLF)
ConsoleWrite("quiet zone: " & $oJsonOut.IntOf("measurements[0].quietZonePx.left") & " pixels" & @CRLF)
ConsoleWrite("padding: " & $oJsonOut.IntOf("measurements[0].paddingPx") & " pixels" & @CRLF)
ConsoleWrite("rotation: " & $oJsonOut.IntOf("measurements[0].rotation") & @CRLF)
ConsoleWrite("image: " & $oJsonOut.IntOf("measurements[0].canvasWidth") & " x " & $oJsonOut.IntOf("measurements[0].canvasHeight") & " pixels" & @CRLF)
; The image, enlarged, with the quiet zone and the padding tinted here to show where they are.
; In the image itself both are plain white. A QR code has no finder pattern (the large squares)
; in its bottom right corner. After the quarter turn that corner is at the bottom left:
;
; Sample output:
; module: 6 pixels
; symbol: 174 x 174 pixels at (46,46)
; quiet zone: 36 pixels
; padding: 10 pixels
; rotation: 90
; image: 266 x 266 pixels