Skip to content

Commit 6b2d756

Browse files
committed
fix: save detected box image to a temporary path but cross-platform
1 parent 51db4cd commit 6b2d756

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

utils/auto_crop.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,10 @@ def draw_largest_box(
100100
x1, y1, x2, y2 = box
101101
draw = ImageDraw.Draw(img)
102102
draw.rectangle([x1, y1, x2, y2], outline="red", width=10)
103-
img.save("/tmp/detected_box.jpg")
103+
temp_path = (
104+
Path(tempfile.gettempdir()) / f"detected_box_{Path(image_path).stem}.jpg"
105+
)
106+
img.save(str(temp_path))
104107
if output_path:
105108
img.save(str(output_path))
106109
return img

0 commit comments

Comments
 (0)