Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 6, 2018 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/268711ade6f3d481ee7e2e1e1c5250bd to your computer and use it in GitHub Desktop.
Save parzibyte/268711ade6f3d481ee7e2e1e1c5250bd to your computer and use it in GitHub Desktop.
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