Format prigreypng with black
@@ -23,15 +23,15 @@ def as_grey(out, inp):
r = png.Reader(file=inp)
_, _, rows, info = r.asDirect()
- if info['greyscale']:
+ if info["greyscale"]:
w = png.Writer(**info)
return w.write(out, rows)
- planes = info['planes']
+ planes = info["planes"]
targetplanes = planes - 2
- alpha = info['alpha']
- width, height = info['size']
- typecode = 'BH'[info['bitdepth'] > 8]
+ alpha = info["alpha"]
+ width, height = info["size"]
+ typecode = "BH"[info["bitdepth"] > 8]
# Values per target row
vpr = width * targetplanes
@@ -49,11 +49,11 @@ def as_grey(out, inp):
targetrow = green
# Check R and B channel match.
if green != row[0::planes] or green != row[2::planes]:
- raise ValueError('Row %i contains non-grey pixel.' % i)
+ raise ValueError("Row %i contains non-grey pixel." % i)
yield targetrow
- info['greyscale'] = True
- del info['planes']
+ info["greyscale"] = True
+ del info["planes"]
w = png.Writer(**info)
return w.write(out, iterasgrey())
@@ -63,10 +63,11 @@ def main(argv=None):
argv = sys.argv
argv = argv[1:]
if len(argv) > 0:
- f = open(argv[0], 'rb')
+ f = open(argv[0], "rb")
else:
f = png.binary_stdin()
return as_grey(png.binary_stdout(), f)
-if __name__ == '__main__':
+
+if __name__ == "__main__":
sys.exit(main())
