Browse Source

fixed image cropping bug (that was introducing an offset compared to the TechDraw view)

pull/2/head
Youen 2 years ago
parent
commit
1966fb7e13
  1. 5
      ahb_raster_view.py

5
ahb_raster_view.py

@ -252,8 +252,9 @@ class RasterView:
# Crop the image, which is also used to deduce the center of the source view
original_size = composite_img.size
bg = Image.new(composite_img.mode, composite_img.size, '#ffffff') # fills an image with the background color
diff = ImageChops.difference(composite_img, bg) # diff between the actual image and the background color
diff_source_img = composite_img.split()[3]
bg = Image.new(diff_source_img.mode, diff_source_img.size, '#000000') # fills an image with the background color
diff = ImageChops.difference(diff_source_img, bg) # diff between the actual image and the background color
bbox = diff.getbbox() # finds border size (non-black portion of the image)
composite_img = composite_img.crop(bbox)

Loading…
Cancel
Save