segmentation (dict): Output of the segment method.
records (list): A list of ocr_record objects.
im_str = im.filename if hasattr(im, "filename") else repr(im)
logger.info(u"Adding page {} with {} lines".format(im_str, len(segmentation) if segmentation else len(records)))
page = {}
fd = BytesIO()
im.save(fd, format="png", optimize=True)
After Change
segmentation (dict): Output of the segment method.
records (list): A list of ocr_record objects.
im_str = get_im_str(im)
logger.info(u"Adding page {} with {} lines".format(im_str, len(segmentation) if segmentation else len(records)))
page = {}
fd = BytesIO()
im.save(fd, format="png", optimize=True)