Last active
December 19, 2015 21:28
-
-
Save dobrych/6019979 to your computer and use it in GitHub Desktop.
Revisions
-
dobrych revised this gist
Jul 23, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ data = list(res[2]) # second row, first one could be distorted # data[1] json_palette = ["rgb%s" % str(palette[v]) for v in data[1]] -
dobrych created this gist
Jul 17, 2013 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ import png f = open('palette.png', 'r') p = png.Reader(f) res = p.read() palette = res[3]['palette'] data = list(res[2]) # second row, first one could be distorted data[1] json_palette = ["rgb%s" % str(palette[v]) for v in data[1]] print json_palette