From 0a39e3f1a76088cadc3a6e5b9cf0a68cd27b7cff Mon Sep 17 00:00:00 2001 From: Sunil Kumar Sharma <60266947+sunil448832@users.noreply.github.com> Date: Wed, 17 Jan 2024 00:08:00 +0530 Subject: [PATCH] Update separate-figures.py I have read the CLA (https://artifex.com/documents/Artifex%20Contributor%20License%20Agreement.pdf) and herewith accept it. --- examples/extract-vector-graphics/separate-figures.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/extract-vector-graphics/separate-figures.py b/examples/extract-vector-graphics/separate-figures.py index 50e730a..1a20c86 100644 --- a/examples/extract-vector-graphics/separate-figures.py +++ b/examples/extract-vector-graphics/separate-figures.py @@ -29,7 +29,7 @@ def detect_rects(page): # make a list of vector graphics rectangles (IRects are sufficient) prects = sorted( - [(p["rect"] + delta).irect for p in paths], key=lambda r: (r.y1, r.x0) + [p["rect"] + delta for p in paths], key=lambda r: (r.y1, r.x0) ) new_rects = [] # the final list of the joined rectangles @@ -61,7 +61,7 @@ def detect_rects(page): prects = sorted(list(set(prects)), key=lambda r: (r.y1, r.x0)) new_rects = sorted(list(set(new_rects)), key=lambda r: (r.y1, r.x0)) - return [r for r in new_rects if r.width > 5 and r.height > 5] + return [r.irect for r in new_rects if r.width > 5 and r.height > 5] doc = fitz.open(sys.argv[1])