0

I would like to encode a Data Matrix (a kind of QR Code) and export it in .svg vectorized format.

The following program only allows the export in an "image" type extension such as jpg, png or even tif.

from pylibdmtx.pylibdmtx import encode
from PIL import Image
encoded_data = encode('wasi0013'.encode('utf-8'))
img = Image.frombytes('RGB', (encoded_data.width, encoded_data.height), encoded_data.pixels)
img.save("wasi0013.png")

Would you know how to proceed?

Random Davis
  • 6,662
  • 4
  • 14
  • 24
Maxpsx
  • 1
  • So you want to specifically create a vector version of that image, and not just, say, export an SVG that contains a raster image? What have you researched/practiced so far in regards to SVG generation and export? – Random Davis Jan 05 '21 at 16:18
  • As you said, I would like to export as a svg the encoded raster image but I am learning Python so I have any experience with it. – Maxpsx Jan 06 '21 at 18:22
  • Here's how to get a raster image in an SVG, not via Python but just how it's done in the actual SVG file: https://stackoverflow.com/questions/6249664/does-svg-support-embedding-of-bitmap-images So, you'll have to generate an SVG like that with Python, which should be pretty simple since it's just text. – Random Davis Jan 08 '21 at 05:23

0 Answers0