diff --git a/pixelocr/image.py b/pixelocr/image.py index 762fb2f..b410188 100644 --- a/pixelocr/image.py +++ b/pixelocr/image.py @@ -127,11 +127,6 @@ class Image(object): def isspace(self): return not _is_nonblank(self.bitmap) - @property - def key(self): - """Return a byte string uniquely representing the image.""" - return self.tostring() - def tostring(self): """Serialize the image as a string.""" height, width, *_ = self.shape diff --git a/pixelocr/page.py b/pixelocr/page.py index dd9e75f..f4384db 100644 --- a/pixelocr/page.py +++ b/pixelocr/page.py @@ -165,6 +165,12 @@ class Letter(PageObject): super().__init__(image) self.elevation = elevation + @property + def key(self): + """Return a dictionary key uniquely representing this letter.""" + return self.elevation, self.image.tostring() + + class Space(Letter): pass