Home python Working with Python Images

Working with Python Images




python How to generate images of this type

I have a few lines and I need to generate this image

How do I realize this?

Answer 1, Authority 100%

Example of using the Pil


# import of the required modules
FROM PIL Import Image
From Pil Import ImageDraw
From Pil Import ImageFont
DEF Main ():
  # Create a new image
  image = image.New ('RGB', (300, 200), Color = ('Gray'))
  # Object for drawing
  Draw = ImageDraw.DRAW (Image)
  # Load font
  font = imagefont.trutype ("PT-SANS.TTF", 17)
  # Draw text
  Draw.Text ((0, 0), "Example for working with a library Pil", (0, 255, 255), font = font)
  # Saving the image
  image.save ('Example-Text.jpg')
  # Show Image
  image.show ()
if __name__ == '__main__':
  Main ()

Pillow documentation

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions