QR Code encoder library ported to PB

Share your advanced PureBasic knowledge/code with the community.
User avatar
mk-soft
Always Here
Always Here
Posts: 5387
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: QR Code generator library ported to PB

Post by mk-soft »

Great, thank you very much.
Now no more external DLLs.

Searched for URL example :?: How to find the source code in the forum again 8)

Code: Select all

img = qrcodegen::CreateTextImage("https://www.purebasic.fr/english/viewtopic.php?f=12&t=76558")
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: QR Code generator library ported to PB

Post by Saki »

Very nice and useful.
Last edited by Saki on Sun Jan 17, 2021 1:04 am, edited 1 time in total.
地球上の平和
User avatar
tft
User
User
Posts: 84
Joined: Mon Dec 29, 2008 9:34 am

Re: QR Code generator library ported to PB

Post by tft »

OK .....

Code: Select all

   
  ;tex$ = "https://www.sourcemagic.ch/index.html"
  ;tex$ = "mailto:info@sourcemagic.ch/index.html"
  
  tex$ =  "BEGIN:VCARD"+#CR+#LF+
          "VERSION:4.0"+#CR+#LF+
          "FN:Temucin SourceMagic"+#CR+#LF+
          "N:Temucin;Turgut;;;"+#CR+#LF+
          "ADR:;;Bagnhofstr.15;Dachsen;Schweiz;8447;Zürich"+#CR+#LF+
          "TEL;TYPE=cell,work:+41796050735"+#CR+#LF+
          "EMAIL;TYPE=work:turgut.temucin@sourcemagic.ch"+#CR+#LF+
          "ORG:GAMES"+#CR+#LF+
          "NOTE:Privatuntericht : Programmieren lernen"+#CR+#LF+
          "URL:HTTP://www.sourcemagic.ch"+#CR+#LF+
          "End:VCARD"+#CR+#LF

  img = qrcodegen_CreateTextImage(tex$)

Last edited by tft on Sun Jan 17, 2021 12:14 am, edited 1 time in total.
TFT seid 1989
Aktuelles Projekte : Driving School Evergarden
YouTube : Pure Basic to go
FaceBook : Temuçin SourceMagic Games
DISCORD : SourceMagic
W10 , i9 9900K ,32 GB Ram , GTX Titan , 3 Monitore FHD
ARDUINO Freak :-)
User avatar
ChrisR
Addict
Addict
Posts: 1150
Joined: Sun Jan 08, 2017 10:27 pm
Location: France

Re: QR Code generator library ported to PB

Post by ChrisR »

Superb and very useful, thank you for sharing :)
loulou2522
Enthusiast
Enthusiast
Posts: 501
Joined: Tue Oct 14, 2014 12:09 pm

Re: QR Code generator library ported to PB

Post by loulou2522 »

Hi iinfratec,
Is it possible to have a pbprogramm which read PDF, PNG,JPEG ?
THanks for answering
fluent
User
User
Posts: 68
Joined: Sun Jan 24, 2021 10:57 am

Re: QR Code encoder library ported to PB

Post by fluent »

Very good job, thanks!
2 questions:
1/ Where in the code could I change the size of a "dot" (or the resulting qr-code image)? I've tried ResizeImage but it produces bad artefacts which often make the code unreadable by my smartphone
2/ Is it feasible to use a "round dot" style? Like in this example:

Image
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: QR Code encoder library ported to PB

Post by Saki »

Hi,
it's not my code, but I'll give an answer.
Technically it is unwise to make it round, because you remove information giving content.
You must set the #Raw flag when resizing and you must not create the images as JPEG, but as PNG or BMP.

Best Regards Saki
地球上の平和
thanos
Enthusiast
Enthusiast
Posts: 422
Joined: Sat Jan 12, 2008 3:25 pm
Location: Greece
Contact:

Re: QR Code encoder library ported to PB

Post by thanos »

@infratec
Amazing work!
Thanks a lot!
It seems does not support unicode characters
Regards
» myPersonal Banker :: Because you do not need to have a master degree in economics in order to organize your finances!
Rinzwind
Enthusiast
Enthusiast
Posts: 638
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: QR Code encoder library ported to PB

Post by Rinzwind »

Anyway to make it process utf8 correctly? It only works with plain ascii at the moment while the mentioned page at https://www.nayuki.io/page/qr-code-generator-library does work correctly. Example text: ภาษาไทย
User avatar
mk-soft
Always Here
Always Here
Posts: 5387
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: QR Code encoder library ported to PB

Post by mk-soft »

Part encodeText adapted text (#Mode_BYTE) from ASCII to UTF8.
works fine with my Mobil App "Barcode Scanner" :wink:

Code: Select all

; See first post ;)
Last edited by mk-soft on Sat Dec 11, 2021 12:50 am, edited 1 time in total.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
infratec
Always Here
Always Here
Posts: 6866
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: QR Code encoder library ported to PB

Post by infratec »

I updated both versions on the fisrt page.
Also synchronized with the latest github version from 10 days ago.
User avatar
Lunasole
Addict
Addict
Posts: 1091
Joined: Mon Oct 26, 2015 2:55 am
Location: UA
Contact:

Re: QR Code encoder library ported to PB

Post by Lunasole »

Your code seems good (as many of your codes).
There is Notepad++ plugin to generate QR of selected text, but it seems really bugged.
May make another plugin of that library
"W̷i̷s̷h̷i̷n̷g o̷n a s̷t̷a̷r"
PeteM
User
User
Posts: 12
Joined: Thu Mar 05, 2015 8:44 pm

Re: QR Code encoder library ported to PB

Post by PeteM »

Anyone know how to change the background colour of the image, or to make it transparent?
infratec
Always Here
Always Here
Posts: 6866
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: QR Code encoder library ported to PB

Post by infratec »

Modified the code in the first post.
Post Reply