Black pipwindow
@@ -34,8 +34,9 @@ def window(tl, br, inp, out):
if not (0 <= tl[1] < br[1] <= y):
raise NotImplementedError()
# Compute left and right bounds for each row
- l = tl[0] * meta['planes']
- r = br[0] * meta['planes']
+ l = tl[0] * meta["planes"]
+ r = br[0] * meta["planes"]
+
def itercrop():
"""An iterator to perform the crop."""
@@ -46,10 +47,12 @@ def window(tl, br, inp, out):
# Same as "raise StopIteration"
return
yield row[l:r]
- meta['size'] = (br[0]-tl[0], br[1]-tl[1])
+
+ meta["size"] = (br[0] - tl[0], br[1] - tl[1])
w = png.Writer(**meta)
w.write(out, itercrop())
+
def main(argv=None):
import sys
@@ -65,9 +68,10 @@ def main(argv=None):
if len(argv) in (2, 4):
f = sys.stdin
else:
- f = open(argv[-1], 'rb')
+ f = open(argv[-1], "rb")
return window(tl, br, f, png.binary_stdout())
-if __name__ == '__main__':
+
+if __name__ == "__main__":
main()
