Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions heatmap/heatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,12 +467,12 @@ def closest_index(n, m_list, interpolate=False):

def word_aa(label, pt, fg_color, bg_color):
f = ImageFont.truetype(vera_path, pt*3)
s = f.getsize(label)
s = (s[0], pt*3 + 3) # getsize lies, manually compute
left, top, right, bottom = f.getbbox(label)
s = (right - left, pt*3 + 3) # getsize lies, manually compute
w_img = Image.new("RGB", s, bg_color)
w_draw = ImageDraw.Draw(w_img)
w_draw.text((0, 0), label, font=f, fill=fg_color)
return w_img.resize((s[0]//3, s[1]//3), Image.ANTIALIAS)
return w_img.resize((s[0]//3, s[1]//3), Image.Resampling.LANCZOS)

def blend(percent, c1, c2):
"c1 and c2 are RGB tuples"
Expand Down Expand Up @@ -623,3 +623,4 @@ def create_labels(args, img):
print("saving")
img.save(args.output_path)