deftransform1(image_file): image_file = image_file.convert("L") codePic = '' for h in range(0,image_file.size[1]): for w in range(0,image_file.size[0]): gray = image_file.getpixel((w,h)) codePic = codePic + codeLib[int(((count-1)*gray)/256)] codePic = codePic+'\r\n' return codePic
deftransform2(image_file): codePic = '' for h in range(0,image_file.size[1]): for w in range(0,image_file.size[0]): g,r,b = image_file.getpixel((w,h)) gray = int(r* 0.299+g* 0.587+b* 0.114) codePic = codePic + codeLib[int(((count-1)*gray)/256)] codePic = codePic+'\r\n' return codePic