I try to create QRcode with function FW_BarCodeBmp() and save it to JPG or PNG file but saved picture has black border around QRcode. Is there any way to disable border?
I modified "\fwh\samples\QRcode.prg" to "QRcode1.prg" to make simple example of my problem. In example I also use "oWnd:SayBarCode()" which works well.
Example #1
Code: Select all
#include "fivewin.ch"
REQUEST FWZEBRA // Important
function Main()
local hBmp,cText
cText:="https://ancdefg.hij.hr/rn?ilz=7fc0d4da335dedcf569a4e365fc8cf62&datv=20201107_1036&izn=18,90"
hBmp := FW_BarCodeBmp( cText, "QRCODE", 200, 200 )
FW_SaveImage( hBmp, "name.png" )
return nil
Code: Select all
#include "fivewin.ch"
REQUEST FWZEBRA
//----------------------------------------------------------------------------//
function Main()
local oWnd, cText, cPrg := cFileSetExt( ExeName(), "prg" )
//cText := MEMOREAD( cPrg )
cText := "https://ancdefg.hij.hr/rn?ilz=7fc0d4da335dedcf569a4e365fc8cf62&datv=20201107_1036&izn=18,90"
DEFINE WINDOW oWnd TITLE cPrg FROM 0,0 to 500,200 pixel
ACTIVATE WINDOW oWnd CENTERED ;
ON INIT DrawCode(oWnd,cText)
return nil
//----------------------------------------------------------------------------//
function DrawCode(oWnd,cText)
local oImage, hBmp, hNew
*
* Create QRcode with function FW_BarCodeBmp()
*
hBmp := FW_BarCodeBmp( cText, "QRCODE", 500, 500 )
FW_SaveImage( hBmp, "test1.png" ) // save
@ 37,37 XIMAGE oImage SIZE 110,110 OF oWnd SOURCE "test1.png" // draw QRcode at top of window
*
*
*
oWnd:SayBarCode( cText, { 20,20,-20,-20 }, "QR-CODE" ) // draw QRcode at center of window
*
* Cut part of image ...
*
hNew := FW_TransformBitmap( hBmp, { nil, nil, 0.5, 0.5 }, 1, 0 ) // cut part of image
FW_SaveImage( hNew, "test2.png" ) // save
@ 317,37 XIMAGE oImage SIZE 110,110 OF oWnd SOURCE "test2.png" // draw QRcode at bottom of window
return nil