Skip to content

Instantly share code, notes, and snippets.

@dittos dittos/
Last active Aug 29, 2015

What would you like to do?
@Code_60: Sorting
import sys
from wand.image import Image
from wand.color import Color
from wand.drawing import Drawing
with Image(filename=sys.argv[1]) as img:
pixels = []
for row in img:
for col in row:
print 'sorting'
print 'drawing'
with Drawing() as draw:
for ix, c in enumerate(pixels):
draw.fill_color = c
draw.point(ix % img.width, ix // img.width)
if ix % 100000 == 0: print ix
print 'saving'
with Color('white') as bg:
with Image(width=img.width, height=img.height, background=bg) as i:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.