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 Imageim = 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 overx = 10y = 10x_ll = 1026x = x_llfor i in range(150):y_ll = 205y = y_llfor j in range(836):pix[x,y] = (255, 255, 255, 255)y = y + 1x = x + 1im.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 |


