How to add text in images with Pillow | Python PIL Tutorial Pt. 2

preview_player
Показать описание


If you have any suggestions for future videos, leave it in the comments below.

Some Useful Links -

Queries solved in the video:
2) How to add text in images with python

#PIL #Pillow #Python
Рекомендации по теме
Комментарии
Автор

Congrats man, your hard work and patient has been rewarded with 1K subs

businessorientedprogrammin
Автор

*Congratulations Swas* This is because of your hard work and our support👍

bhavnasharma
Автор

Short, straight to the point, informative. Thank you VERY MUCH!

clrzvrn
Автор

Wow, bro, cool! Go more videos with PIL!

animatea
Автор

Recommendation: make a new function with the code that adds the text and makes the new image, then use asyncio to make a loop and execute the function like:

#import asyncio(comes with discord.py)
import asyncio

#define this outside the command
def text_in_image(img):
draw = ImageDraw.Draw(img)
font = ImageFont.truetype("arial.ttf", 24)
draw.text((0, 150), text, (0, 0, 0), font=font)
img.save("text.png")

#this would be part of the command
img = Image.open(response)
loop = asyncio.get_event_loop()
await loop.run_in_executor(None, text_in_image, img)

await ctx.send(file = discord.File("text.png")

that way your bot won't slow down the more you use the command as it's basically executing the function asynchronously(Pillow isn't async and does blocking)

standingpad
Автор

❤❤❤ THANKS!!!
Now i can make myself my join command(with image)

mazyop
Автор

could you please make a tutorial on how to wrap the inputted text so it doesn’t run off the screen once it’s long enough and how to center the text?

johnythecommie
Автор

When i host the bot command dont work
:(

cau.t
Автор

Idk what I would do without you Swas 👍



By the way can you please make a "use" command for your economy Discord bot?

nadbrawlstars
Автор

How to add a text on image such that u can move the text using your mouse anywhere on the image plzz make a video of this 🙏

gagantechtechnical
Автор

Thankyou for this video it helped me a lot! It works but I have one issue.

I used my own images and coordinates, and my picture is like a person holding a letter. When there is more than 10 lines of text it goes out of the margin and it looks strange. Is there a way to automatically bring it down to the next line when it crosses a word limit?

pohtasiuhm
Автор

Thank you for this content, the similar vídeos is very scarse or outdated, good joob!

WBD
Автор

Congrats on 1k sub, please make a video on fully functional discord music bot in python please sir.

tiergamerpy
Автор

is there a way to use a custom img from my laptop without the having to add text

op-ftlp
Автор

Hello, I love your videos can u make a tutorial on how to join/leave and search for music in youtube like rythm in next video pls

indiangamerbro
Автор

well could you teach us how you made that pet like thingy in start of video pls bro

smilewithelena
Автор

ahh i got no error in the console but this isn't working. I want to make the bot send a welcome card when ever a user enters, so any suggestions ?

ravan
Автор

Im getting an error with the Imagefont

EbayChatFailsMain
Автор

When i run the bot it creates a text.png but without the text. Any help ?

putacaralho
Автор

Hi, can you make a video how to make a greeting in the form of a pillow

animetan
join shbcf.ru