Page 3 of 3

Re: Create QRCode (2D-Barcode)

Posted: Thu Oct 22, 2020 10:59 am
by loulou2522
infratec wrote:That's very 'Basic' :mrgreen:

Code: Select all

If OpenWindow(0, 0, 0, 400, 100, "ImageGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  If LoadImage(0, #PB_Compiler_Home + "Examples\Sources\Data\PureBasicLogo.bmp")
    
    If CreateImage(1, 80, 50, 24, #Red)
      
      If StartDrawing(ImageOutput(0))
        DrawImage(ImageID(1), 80, 15)
        StopDrawing()
      EndIf
    EndIf
    
    ImageGadget(0,  10, 10, 0, 0, ImageID(0))
  EndIf
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf
Thanks infratec I will try to see if the qrcode is readable after including another image

Re: Create QRCode (2D-Barcode)

Posted: Tue Nov 10, 2020 8:21 am
by loulou2522
Can someone help me on How to decode a qrcode with Purebasic. With zbarimg some image can be decodeand other one no
THanks

Re: Create QRCode (2D-Barcode)

Posted: Wed Nov 11, 2020 10:08 am
by dige
Could you please provide us an image?
I have tested ZBar and Pb 5.73B3 x86 and everything seems to work..

Re: Create QRCode (2D-Barcode)

Posted: Fri Nov 13, 2020 7:16 am
by loulou2522
Extraction de l'image faite avec PDFImages

Image

LIens
http://www.sepa-convertir.ch/utilitaire ... cture2.pdf
http://www.sepa-convertir.ch/utilitaire ... /toto2.png

the PDF invoice2.pdf has been processed with PDFCAIRO and the result can be found in
Resultat dans toto.png
Phaseun

Code: Select all

pdftocairo -png -cropbox -x 380 -y 1220 -H 300 -W 298 -gray -transp facture2.pdf

zbarimg.exe -D toto.png
Hoping that this will be enough for you

Re: Create QRCode (2D-Barcode)

Posted: Fri Nov 13, 2020 7:58 am
by infratec
I told you already that the quality of the image inside of the PDF is bad and the extracted image is even worse.

You have to put the generated code in 100% quality inside the PDF.

Re: Create QRCode (2D-Barcode)

Posted: Fri Nov 13, 2020 9:46 am
by loulou2522
infratec wrote:I told you already that the quality of the image inside of the PDF is bad and the extracted image is even worse.

You have to put the generated code in 100% quality inside the PDF.
I know that. I tried to improve the quality of the PDF with GHOSTSCRIPT but it doesn't work. The problem I have is related to ZBARIMAGE (problem already raised in 2017 on the ZBAR forum but not solved to date)
For your information, the file facture2.pdf comes from the validation site of SIX Switzerland, which means that I don't have the hand on the creation of this PDF. I have to treat it as it is. What I don't understand is that software like PDFCandy treats the conversion of the PDF facture2 without any problem into PNG and then the PNG is treated as a QRCODE.

Have you a solution to generated code in 100% quality inside the PDF. ?
I am ready to buy a command line tools for converting PDF into QRCODE via img

Re: Create QRCode (2D-Barcode)

Posted: Fri Nov 13, 2020 10:16 am
by Marc56us
... converting PDF into QRCODE via img...
The PDF format is simply an encapsulation of elements. Text is converted, but images remain in their original format (jpg, bmp, png etc). It is thus enough to extract the whole (provided that the elements are not encrypted).
Do not try to convert a whole PDF file into a single image: this is the worst way to destroy the quality of the original images, thus making QRCodes unreadable.

Extract images from PDF file: There are free tools that do it very well
One of them (freeware)
https://www.pdfarea.com/PDF-Image-Extractor.htm
(There are also probably some available on the command line.)
It does extract the QRCode given in your example. But I was only able to read it one time out of 10 with my phone (while all the other QRCodes I usually read work).

@loulou2522
You had to create another topic, because your question is about reading and not about creating a QRCode :wink: