I want the text to be with a variable, for example:
“gtin:04620757979006”
draw = ImageDraw.Draw(picture)
# Store font for the texts
font = ImageFont.truetype(r"C:UsersuserPycharmProjectspythonProjectarial.ttf", 12)
# Draw texts on the Picture
datamatrix_text_position_px = (25, 115)
draw.text(datamatrix_text_position_px, text=gtin, fill = 'black', font = font)
# Save the image
picture.save("datamatrix.png")
gtin = "04620757979006"
but in any case I get an error. For example:
draw.text(datamatrix_text_position_px, text="gtin:" str(gtin), fill = 'black', font = font)
Also I want that the text is in higher resolution, but if I change it for
enter image description here
picture.save("datamatrix.png", dpi=(300, 300)) it resize all image to small
enter image description here
but in any case I get an error. For example:
draw.text(datamatrix_text_position_px, text="gtin:" str(gtin), fill = 'black', font = font)
Also I want that the text is in higher resolution, but if I change it for
enter image description here
picture.save("datamatrix.png", dpi=(300, 300)) it resize all image to small
enter image description here
New contributor
Valentin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.