PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities.
PIL.Image.new() method creates a new image with the given mode and size. Size is given as a
(width, height)-tuple, in pixels. The color is given as a single value for single-band images, and a tuple for multi-band images (with one value for each band).
We can also use color names. If the color argument is omitted, the image is filled with zero (this usually corresponds to black). If the color is None, the image is not initialized. This can be useful if you’re going to paste or draw things in the image.
PIL.Image.new(mode, size, color)
mode: The mode to use for the new image. (It could be RGB, RGBA)
size: A 2-tuple containing (width, height) in pixels.
color: What color to use for the image. Default is black. If given, this should be a single integer or floating point value for single-band modes, and a tuple for multi-band modes.
Return Value: An Image object.
One can alter the value of color tuple to get different colors or we can simply use color name (for single band images).
- class method vs static method in Python
- Python | next() method
- Python | set() method
- Python | os.dup() method
- Python | os.mknod() method
- Python | os.lchflags() method
- Python | os.symlink() method
- Python | os.fsync() method
- Python | os.tcgetpgrp() method
- Python | os.ctermid() method
- Python | os.getpgid() method
- Python | os.getppid() method
- Python | os.readlink() method
- Python | os.writev() method
- Python | os.readv() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.