I can make some .png files using PIL
and tkinter
:
import tkinter
from PIL import ImageGrab
canvas = tkinter.Canvas(width=100, height=100)
SomeInterestingPhotoImage = PhotoImage(file='Path/To/My/file.png')
canvas.create_image(0, 0, image=SomeInterestingPhotoImage, anchor='nw')
x0 = canvas.winfo_rootx()
y0 = canvas.winfo_rooty()
x1 = x0 + canvas.winfo_width()
y1 = y0 + canvas.winfo_height()
image = ImageGrab.grab((x0, y0, x1, y1))
image.save(name.png)
# I need to make some pixels transparent.
Here I can make an .png file, but all pixels have some colour. I need to make white pixels of canvas (not of image) transparent.