Exemple d'utilisation de PIL pour effacer la colormap d'une figure réalisée avec Maptlotlib (Note: la figure en sortie conserve sa dimension initiale).
import Image
im = Image.open("input.png") #Can be many different formats.
pix = im.load()
print im.size #Get the width and hight of the image for iterating over
x = 10
y = 10
x_ll = 1026
x = x_ll
for i in range(150):
y_ll = 205
y = y_ll
for j in range(836):
pix[x,y] = (255, 255, 255, 255)
y = y + 1
x = x + 1
im.save("output.png", "PNG")
im.show()
Recherches associées
Liens | Site |
---|---|
PIL | PIL module |
Read the RGB value of a given pixel in Python, Programatically | stack overflow |
Python: PIL replace a single RGBA color | stackoverflow |
Using PIL to make all white pixels transparent? | stackoverflow |
PIL Best Way To Replace Color? | stackoverflow |
Remove background colour from image using Python/PIL | stackoverflow |