diff --git a/lib.py b/lib.py index fc74b16..69a64ee 100644 --- a/lib.py +++ b/lib.py @@ -58,6 +58,12 @@ class Picture: assert result.h == ht return result + def at(x, y): + return self.pixels[ + int(max(0, min(self.h - 1, y))), + int(max(0, min(self.w - 1, x))), + ] + def _to_pil(self): # Create int iterable # TODO: If this is slow, we should use a generator.