VOOZH about

URL: https://www.geeksforgeeks.org/python/python-pil-imagedraw-draw-rectangle/

⇱ Python PIL | ImageDraw.Draw.rectangle() - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Python PIL | ImageDraw.Draw.rectangle()

Last Updated : 2 Aug, 2019
PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The ImageDraw module provide simple 2D graphics for Image objects. You can use this module to create new images, annotate or retouch existing images, and to generate graphics on the fly for web use. ImageDraw.Draw.rectangle() Draws an rectangle.
Syntax: PIL.ImageDraw.Draw.rectangle(xy, fill=None, outline=None) Parameters: xy – Four points to define the bounding box. Sequence of either [(x0, y0), (x1, y1)] or [x0, y0, x1, y1]. The second point is just outside the drawn rectangle. outline – Color to use for the outline. fill – Color to use for the fill. Returns: An Image object in rectangle shape.
Output: 👁 Image
Another Example: Here we use different colour for filling.
Output: 👁 Image
Comment
Article Tags:
Article Tags: