Skip to content

Instantly share code, notes, and snippets.

@vane90
Created July 2, 2013 02:35
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 vane90/5906403 to your computer and use it in GitHub Desktop.
Save vane90/5906403 to your computer and use it in GitHub Desktop.
import sys,pygame
import Image
from math import*
from time import*
import math
from PIL import Image
from sys import argv # Importe para tabajar con argumentos
def main():
foto1 = binarizar ()
def binarizar():
image1 = Image.open("nueva.png")
pixels = image1.load()
ancho,alto = image1.size
minimo = int(argv[2])
for i in range(ancho):
for j in range(alto):
if pixels[i,j][1] < minimo:
p=0
else:
p= 255
pixels[i,j]=(p,p,p)
#fin = time()
#tiempo_t = fin - inicio
#print "Tiempo que tardo en ejecutarse binzarizar = "+str(tiempo_t)+" segundos"
new = 'binarizas.jpg'
image1.save(new)
#return new
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment