Things That I've Learned from John Mama video which is about PIL!
first of all
make sure that you've installed PILLOW
pip3 install pillow
Even with custom mode
Mode Means like RGB , RGB with alpha , greyscale,
from PIL import Image #importing Image from PIL to open
1.Here we just imported Image class from PIL
new() method can be used to create new image
object=image.new(mode,size,color)
img=Image.new("RGB",(720,488),"blue")
img.show()
To Save An Image :
img.save("newimage.png")
Extension Must be included (if extension is png it will save it as png)
if (len(sys.argv)!=4):
print("python3 new.py file.png blue mode(RGB,L)")
else :
nameof_file=sys.argv[1]
color=sys.argv[2]
mod=sys.argv[3]
size=720,650 #width andd height of the image has been defined!
image=Image.new(mod,size,color) #creates the
image.save(nameof_file)
it just takes input from command line argument and produce the respective output
appram varean bye