Created
April 6, 2018 14:47
-
-
Save parzibyte/268711ade6f3d481ee7e2e1e1c5250bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
imagen = Image.open("back_to_the_future.png") # Aquí puedes cambiar el nombre de la imagen | |
pixeles = imagen.load() | |
tamaño = imagen.size | |
anchura = tamaño[0] | |
altura = tamaño[1] | |
print("La anchura de la imagen es {}".format(anchura)) | |
print("La altura de la imagen es {}".format(altura)) | |
for x in range(anchura): | |
for y in range(altura): | |
pixel = pixeles[x, y] | |
rojo = pixel[0] | |
verde = pixel[1] | |
azul = pixel[2] | |
print("Rojo: {}".format(rojo)) | |
print("Verde: {}".format(verde)) | |
print("Azul: {}".format(azul)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment