added argparse

master
Your Name 5 years ago
parent 5feb8a2cca
commit bfd242ca87

@ -1,3 +1,4 @@
import argparse
import sys
import os
import six
@ -57,15 +58,19 @@ def _int_low_high(inp_number, out_bytes):
return outp
filename = u"img.jpg"
parser = argparse.ArgumentParser(description='Process some imagefile')
parser.add_argument('--img',dest="img",
help='pass image to print')
args = parser.parse_args()
filename = args.img
im = Image.open(filename)
basewidth = 600
basewidth = 350
# Initial rotate. mirror, and extract blobs for each 8 or 24-pixel row
# Convert to black & white via greyscale (so that bits can be inverted)
im = im.transpose(Image.ROTATE_270).transpose(Image.FLIP_LEFT_RIGHT)
width_pixels,height_pixels = im.size
height_pixels, width_pixels = im.size
if width_pixels > basewidth:
wpercent = (basewidth/float(im.size[0]))

Loading…
Cancel
Save