forked from youen/assembly_handbook
fixed image cropping bug (that was introducing an offset compared to the TechDraw view)
This commit is contained in:
parent
3c7bdc2a4c
commit
1966fb7e13
@ -252,8 +252,9 @@ class RasterView:
|
|||||||
# Crop the image, which is also used to deduce the center of the source view
|
# Crop the image, which is also used to deduce the center of the source view
|
||||||
original_size = composite_img.size
|
original_size = composite_img.size
|
||||||
|
|
||||||
bg = Image.new(composite_img.mode, composite_img.size, '#ffffff') # fills an image with the background color
|
diff_source_img = composite_img.split()[3]
|
||||||
diff = ImageChops.difference(composite_img, bg) # diff between the actual image and the background color
|
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)
|
bbox = diff.getbbox() # finds border size (non-black portion of the image)
|
||||||
composite_img = composite_img.crop(bbox)
|
composite_img = composite_img.crop(bbox)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user