ImageEn, unit iexHelperFunctions

TIEBitmapHelper.GenerateQRCode

TIEBitmapHelper.GenerateQRCode

Declaration

function GenerateQRCode(const Text: string; ModulePixels: Integer = 8; CorrectionLevel: TIEVisionQRCodeCorrectionLevel = ievQRCorrectL): Boolean;

Description

A shortcut method that creates a TIEVisionQRCodeEncoder object and calls encode to replace the image with a QR code of Text.
ModulePixels is the width in pixels of one module (square) of the code, from 1 to 32 (values outside this range are clamped). A quiet zone of four modules is included around the symbol.
CorrectionLevel specifies how much of the code can be damaged or obscured and still be read (L: ~7%, M: ~15%, Q: ~25%, H: ~30%). Higher levels create larger codes.
Text is encoded as UTF-8.
Returns False (and the image is not changed) if Text is empty or no code could be generated.


Note:
◼You must add the iexHelperFunctions unit to your uses clause
◼Delphi/C++ 2005 or newer is required to use helper classes
◼The resulting image is 8 bit gray scale. Change the PixelFormat if you need a color image
◼QR code generation requires IEVision. You will need to register it before calling the method

Method Behavior

The following call:
ImageEnView1.IEBitmap.GenerateQRCode( 'https://www.imageen.com', 8, ievQRCorrectM );
Is the same as calling:
encoder := IEVisionLib.createQRCodeEncoder();
encoder.setCorrectionLevel( ievQRCorrectM );
ImageEnView1.IEBitmap.AssignIEVisionImage( encoder.encode( 'https://www.imageen.com', 8 ));

Demo

Demo  Demos\IEVision\QRCode\QRCode.dpr

Example

Also see: Automated Samples
// Create a QR code for our web site and save it
if ImageEnView1.IEBitmap.GenerateQRCode( 'https://www.imageen.com', 8, ievQRCorrectM ) then
begin
  ImageEnView1.Update();
  ImageEnView1.IO.SaveToFile( 'D:\ImageEnQR.png' );
end;

See Also

◼ScanQRCode
◼TIEVisionQRCodeEncoder
◼encode