V
V
VladikTanashuk2021-10-16 18:46:50
Python
VladikTanashuk, 2021-10-16 18:46:50

How can I send an image without saving it. Aiogram library?

How can I send a PILLOW-processed image of a user to a chat with him?

@dp.message_handler(content_types=['photo'], state=filter.photo)
async def load_photo(message: types.Message, state: FSMContext):
    async with state.proxy() as data:
        data['photo'] = message.photo[0].file_id
    await filter.next()
    await bot.send_message(message.from_user.id, 'Теперь, выберите тип фильтра, что будет наложен на изображение.', reply_markup=nav.filtersMenu)

@dp.message_handler(state=filter.set_filter)
async def set_filter(message: types.Message, state: FSMContext):
    async with state.proxy() as data:
        data['filter'] = message.text
    async with state.proxy() as data:
        if data['filter'] == 'Контур':
            file_info = await bot.get_file(data['photo'])

So far, the only thing I've been able to get is a small image with a filter applied to it:
616af3d2130e7060335614.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question