A
A
AlmazKayum2020-04-14 16:33:28
Python
AlmazKayum, 2020-04-14 16:33:28

A joint with a QR code made in Python when sent to Telegram. How to fix?

The task is to create a QR code and send a picture to telegram.
There is such a code, it is working, but with a nuance

import pyqrcode
qr_obj = pyqrcode.create('QR ТЕКСТ')
buffer = BytesIO()
qr_obj.png(buffer)
bot.send_photo(chat_id=some_chat_id, photo=buffer.getvalue())


The nuance is that the QR code is sent very small to Telegram, with a very small extension. Screenshot is attached. I assume that you need to send not a PNG image, but a JPG.
Well, I don't even know why. Help what can be done about this?
5e95bb8ba0794054602387.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2020-04-14
@AlmazKayum

have you read the documentation ?

import pyqrcode
qr_obj = pyqrcode.create('QR ТЕКСТ')
buffer = BytesIO()
qr_obj.png(buffer, scale=10)
bot.send_photo(chat_id=some_chat_id, photo=buffer.getvalue())

S
Sergey Pankov, 2020-04-14
@trapwalker

JPEG is not needed.
Scale the png with PIL (Pillow)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question