I would like to combine 4 PNG images to one PNG file. I know who to combine them with Image.paste method, but I couldn't create an save output file! Actually, I want to have a n*m empty PNG file, and use to combine my images. I need to specify the file size, if not I couldn't use paste method.
INSTALLATION. PyPNG is pure Python and has no dependencies. It requires Python 3.5 or any compatible higher version. to access the png module in your Python program.
from PIL import Image image = Image.new('RGB', (n, m))
You can use the method PIL.Image.new()
to create the image. But the default color is in black. To make a totally white-background empty image, you can initialize it with the code:
from PIL import Image img = Image.new("RGB", (800, 1280), (255, 255, 255)) img.save("image.png", "PNG")
It creates an image with the size 800x1280 with white background.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With