Python Forum
code decode, string, image ...
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
code decode, string, image ...
#1
This is code to decode QR image to ascii. I would like to code asci string to QR image...
So i need the opposite of this code..

How can i do it ?
Tnx
Teckow :)

#!/usr/bin/env python

import sys
import zlib
import pprint

import PIL.Image
import pyzbar.pyzbar
import base45
import cbor2

data = pyzbar.pyzbar.decode(PIL.Image.open(sys.argv[1]))
cert = data[0].data.decode()

b45data = cert.replace("HC1:", "")

zlibdata = base45.b45decode(b45data)

cbordata = zlib.decompress(zlibdata)

decoded = cbor2.loads(cbordata)

pprint.pprint(cbor2.loads(decoded.value[2]))
Yoriz write Aug-20-2021, 06:40 PM:
Please post all code, output and errors (in their entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Reply
#2
I found the following on pypi, you could give it a try.
https://pypi.org/project/qrcode/
Reply
#3
hi

this is the full working code..
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Decode string ? JohnnyCoffee 1 821 Jan-11-2023, 12:29 AM
Last Post: bowlofred
  New2Python: Help with Importing/Mapping Image Src to Image Code in File CluelessITguy 0 727 Nov-17-2022, 04:46 PM
Last Post: CluelessITguy
  Correct the algorithm of image filter code saoko 6 2,021 May-08-2022, 05:06 PM
Last Post: saoko
  [split] Kera Getting errors when following code example Image classification from scratch hobbyist 3 4,636 Apr-13-2021, 01:26 PM
Last Post: amirian
  I need a code line to spam a keyboard key | Image detection bot Aizou 2 3,127 Dec-06-2020, 10:10 PM
Last Post: Aizou
  how to encode and decode same value absolut 2 2,348 Sep-08-2020, 09:46 AM
Last Post: TomToad
  Help me get this image converter code working? NeTgHoSt 0 2,085 Jul-14-2020, 10:36 PM
Last Post: NeTgHoSt
  python-resize-image unicode decode error Pedroski55 3 3,491 Apr-21-2020, 10:56 AM
Last Post: Pedroski55
  struct.decode() and '\0' deanhystad 1 3,228 Apr-09-2020, 04:13 PM
Last Post: TomToad
  Print string after decode martinzeifang 1 1,834 Jan-02-2020, 10:16 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020