#๐Ÿ”’ making rainbow text with PIL

7 messages ยท Page 1 of 1 (latest)

twilit hamlet
#

trying to make rainbow text with PIL using masking. i think i'm somewhat close but i have no idea what's going on

rich pondBOT
#

@twilit hamlet

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

twilit hamlet
#

current code:

temp_img = Image.new('RGBA', (560, 240), (255, 255, 255, 255)) # creating a new temp image with the same dimensions as the canvas
draw_temp = ImageDraw.Draw(temp_img) # defining temporary image drawer
draw_temp.text((text_x, 50), text, fill=(0, 0, 0, 255), font=font) # drawing the text onto the temporary image in black
rainbow_image = Image.open("angryimg.png") # importing the reference rainbow picture
result = Image.composite(canvas, rainbow_image, temp_img) # masking the rainbow imagine onto the black and white temporary image
canvas = result # making the result the new canvas to draw further text on
#

i hope the comments make sense

#

please ping me in replies so i can come back to this

rich pondBOT
#

@twilit hamlet

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.