Yaz Hobooti commited on
Commit
223bf48
·
1 Parent(s): 507d05e

Remove numbered labels from error and change markers

Browse files

- Remove red_labels parameter from draw_boxes_multi() function
- Remove label rendering code that added numbers to difference boxes
- Clean up function calls to remove unused labels parameter
- Difference boxes now show without numbered labels for cleaner display
- Maintains all other functionality (red boxes for differences, cyan for misspellings, green for barcodes)

Files changed (1) hide show
  1. pdf_comparator.py +3 -11
pdf_comparator.py CHANGED
@@ -297,19 +297,12 @@ def find_diff_boxes(diff_img: Image.Image, threshold: int = 12, min_area: int =
297
  return out
298
 
299
  def draw_boxes_multi(img: Image.Image, red_boxes: List[Box], cyan_boxes: List[Box], green_boxes: List[Box] = None,
300
- width: int = 3, red_labels: List[int] = None) -> Image.Image:
301
  out = img.copy(); d = ImageDraw.Draw(out)
302
  # red (diff)
303
  for b in red_boxes:
304
  for w in range(width):
305
  d.rectangle([b.x1-w,b.y1-w,b.x2+w,b.y2+w], outline=(255,0,0))
306
- # labels for red boxes
307
- if red_labels:
308
- for idx, b in enumerate(red_boxes):
309
- label = str(red_labels[idx]) if idx < len(red_labels) else str(idx+1)
310
- tx = max(0, b.x1 + 3); ty = max(0, b.y1 + 3)
311
- d.rectangle([tx-2, ty-2, tx+14, ty+14], fill=(255,255,255))
312
- d.text((tx, ty), label, fill=(0,0,0))
313
  # cyan (misspellings)
314
  for b in cyan_boxes:
315
  for w in range(width):
@@ -861,11 +854,10 @@ def compare_pdfs(file_a, file_b):
861
 
862
  # Always enable CMYK analysis
863
  cmyk_entries = compute_cmyk_diffs(a, b, red_boxes)
864
- labels = [e['idx'] for e in cmyk_entries]
865
 
866
  # Create visualizations with default box width
867
- a_boxed_core = draw_boxes_multi(a, red_boxes, misspell_a, bar_a, width=3, red_labels=labels)
868
- b_boxed_core = draw_boxes_multi(b, red_boxes, misspell_b, bar_b, width=3, red_labels=labels)
869
 
870
  # Always show CMYK panel
871
  a_disp = draw_cmyk_panel(a_boxed_core, cmyk_entries, title='CMYK Analysis (A vs B)')
 
297
  return out
298
 
299
  def draw_boxes_multi(img: Image.Image, red_boxes: List[Box], cyan_boxes: List[Box], green_boxes: List[Box] = None,
300
+ width: int = 3) -> Image.Image:
301
  out = img.copy(); d = ImageDraw.Draw(out)
302
  # red (diff)
303
  for b in red_boxes:
304
  for w in range(width):
305
  d.rectangle([b.x1-w,b.y1-w,b.x2+w,b.y2+w], outline=(255,0,0))
 
 
 
 
 
 
 
306
  # cyan (misspellings)
307
  for b in cyan_boxes:
308
  for w in range(width):
 
854
 
855
  # Always enable CMYK analysis
856
  cmyk_entries = compute_cmyk_diffs(a, b, red_boxes)
 
857
 
858
  # Create visualizations with default box width
859
+ a_boxed_core = draw_boxes_multi(a, red_boxes, misspell_a, bar_a, width=3)
860
+ b_boxed_core = draw_boxes_multi(b, red_boxes, misspell_b, bar_b, width=3)
861
 
862
  # Always show CMYK panel
863
  a_disp = draw_cmyk_panel(a_boxed_core, cmyk_entries, title='CMYK Analysis (A vs B)')