Skip to content

Commit

Permalink
workspace.image_from_{page,segment}: consider AlternativeImage w/o co…
Browse files Browse the repository at this point in the history
  • Loading branch information
kba committed Oct 23, 2020
1 parent 2506e7e commit c87dc01
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ocrd/ocrd/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def image_from_page(self, page, page_id,
# search from the end, because by convention we always append,
# and among multiple satisfactory images we want the most recent:
for alternative_image in reversed(alternative_images):
features = alternative_image.get_comments()
features = alternative_image.get_comments() or ''
if (all(feature in features
for feature in feature_selector.split(',') if feature) and
not any(feature in features
Expand All @@ -425,7 +425,7 @@ def image_from_page(self, page, page_id,
alternative_image = None
else:
alternative_image = alternative_images[-1]
features = alternative_image.get_comments()
features = alternative_image.get_comments() or ''
if alternative_image:
log.debug("Using AlternativeImage %d (%s) for page '%s'",
alternative_images.index(alternative_image) + 1,
Expand Down Expand Up @@ -752,7 +752,7 @@ def image_from_segment(self, segment, parent_image, parent_coords,
# search from the end, because by convention we always append,
# and among multiple satisfactory images we want the most recent:
for alternative_image in reversed(alternative_images):
features = alternative_image.get_comments()
features = alternative_image.get_comments() or ''
if (all(feature in features
for feature in feature_selector.split(',') if feature) and
not any(feature in features
Expand All @@ -762,7 +762,7 @@ def image_from_segment(self, segment, parent_image, parent_coords,
alternative_image = None
else:
alternative_image = alternative_images[-1]
features = alternative_image.get_comments()
features = alternative_image.get_comments() or ''
if alternative_image:
log.debug("Using AlternativeImage %d (%s) for segment '%s'",
alternative_images.index(alternative_image) + 1,
Expand Down

0 comments on commit c87dc01

Please sign in to comment.