Skip to content

Instantly share code, notes, and snippets.

@narcelio
Created November 1, 2017 18:23
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 narcelio/f723d405590d7b065ac5b5834721ab48 to your computer and use it in GitHub Desktop.
Save narcelio/f723d405590d7b065ac5b5834721ab48 to your computer and use it in GitHub Desktop.
Viacoin second image decription
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# (c) Copyright 2017 by Narcelio Filho <narcelio@gmail.com>
from PIL import Image
from PIL import ImageOps
import numpy
im = Image.open('tpSCvHx.png')
bw = im.convert('L', dither=Image.NONE)
g = numpy.asarray(bw)
g = g < 80
m = Image.fromarray(g, '1')
m = ImageOps.invert(m.convert('L'))
m.show()
#m.save('/tmp/m.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment