Skip to content

Commit

Permalink
fix bug: crop supports gray image
Browse files Browse the repository at this point in the history
  • Loading branch information
xinntao committed Aug 25, 2022
1 parent 8dc3cba commit 3f20f4a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions handyview/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def crop_images(img_list,

# draw rectangle
if line_width > 0:
draw = ImageDraw.Draw(img)
img_rect = img.convert('RGB')
draw = ImageDraw.Draw(img_rect)
draw.rectangle(((start_w, start_h), (start_w + len_w, start_h + len_h)), outline=color, width=line_width)
img.save(os.path.join(rect_folder, base_name + '_rect.png'))
img_rect.save(os.path.join(rect_folder, base_name + '_rect.png'))

0 comments on commit 3f20f4a

Please sign in to comment.