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


Messages In This Thread
code decode, string, image ... - by teckow - Aug-20-2021, 06:28 PM
RE: code decode, string, image ... - by Yoriz - Aug-20-2021, 06:46 PM
RE: code decode, string, image ... - by teckow - Aug-20-2021, 07:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  QR code creation with image Raja31 1 1,209 Jan-15-2025, 11:17 AM
Last Post: Larz60+
  Decode string ? JohnnyCoffee 1 1,565 Jan-11-2023, 12:29 AM
Last Post: bowlofred
  New2Python: Help with Importing/Mapping Image Src to Image Code in File CluelessITguy 0 1,286 Nov-17-2022, 04:46 PM
Last Post: CluelessITguy
  Correct the algorithm of image filter code saoko 6 3,612 May-08-2022, 05:06 PM
Last Post: saoko
  [split] Kera Getting errors when following code example Image classification from scratch hobbyist 3 5,744 Apr-13-2021, 01:26 PM
Last Post: amirian
  I need a code line to spam a keyboard key | Image detection bot Aizou 2 4,702 Dec-06-2020, 10:10 PM
Last Post: Aizou
  how to encode and decode same value absolut 2 3,870 Sep-08-2020, 09:46 AM
Last Post: TomToad
  Help me get this image converter code working? NeTgHoSt 0 2,813 Jul-14-2020, 10:36 PM
Last Post: NeTgHoSt
  python-resize-image unicode decode error Pedroski55 3 4,573 Apr-21-2020, 10:56 AM
Last Post: Pedroski55
  struct.decode() and '\0' deanhystad 1 5,645 Apr-09-2020, 04:13 PM
Last Post: TomToad

Forum Jump:

User Panel Messages

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