I want to get a photo of the qr code and decrypt it, but I don't want to save the qr code to disk,
await message.photo[-1].download(destination_file = "aaa.png")
can I somehow work with the resulting image without saving it?
import cv2
from pyzbar import pyzbar
@dp.message_handler(state=QrScanState.Qr_Scan_Data, content_types=types.ContentType.PHOTO)
async def send_qr_data(message: types.Message, state: FSMContext):
await message.photo[-1].download(destination_file = "aaa.png")
img = cv2.imread("aaa.png")
barcodes = pyzbar.decode(img)
await bot.send_message(chat_id = message.from_user.id, text = barcodes[0].data.decode())
await state.finish()
I tried to work without saving the photo, but, as I understand it, the file_id of the photo is in the list
img = cv2.imread(message.photo[-1])
TypeError: Can't convert object to 'str' for 'filename'