Skip to content

Commit d665bee

Browse files
committed
fix cropping logic to not change the size of the image but still crop out the edges where the dots go bad
1 parent 3831344 commit d665bee

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

jam_image_filter/halftone.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ def rnd():
1010
return 1 + random.randint(-1, 1) / 6.0
1111

1212
def halftone(original, radius=3, border=21, black_and_white=False):
13-
# original = util.resize_jam_background(original, util.WIDTH + border * 2,
14-
# util.HEIGHT + border * 2)
13+
14+
owidth, oheight = original.size
15+
original = util.resize_jam_background(original, owidth + border * 2,
16+
oheight + border * 2)
1517
original = original.convert('RGB')
1618
width, height = original.size
1719

@@ -52,7 +54,7 @@ def halftone(original, radius=3, border=21, black_and_white=False):
5254
draw.ellipse((x - r * rnd(), y - r * rnd(), x + r * rnd(), y + r * rnd()), pen, brush)
5355
draw.flush()
5456

55-
# new = util.centre_crop(new, util.WIDTH, util.HEIGHT)
57+
new = util.centre_crop(new, owidth, oheight)
5658
new = new.point(lambda p: p - 20)
5759

5860
return new

0 commit comments

Comments
 (0)