Commit 08d8665c authored by dmMaze's avatar dmMaze
Browse files

fix empty balloon crashing doc export #266

parent a8ddd18f
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -440,6 +440,12 @@ def gen_ballon_cuts(cuts_dir: str, imgpath: str, blk_list: List[TextBlock], resi

        cut_path = os.path.join(cuts_dir, f'{imgname}-{ii}.jpg')
        bub = img[y1:y2, x1:x2]

        if bub.shape[0] < 1 or bub.shape[1] < 1:
            emptyw = 60
            resized = np.full((emptyw, emptyw, 3), fill_value=0, dtype=np.uint8)
            width = emptyw
        else:
            # scale_percent = 60 # percent of original size
            scale_percent = 1280 / img.shape[0]
            width = max(1, int(bub.shape[1] * scale_percent))