Skip to content

Commit

Permalink
Fix: Export result to .png error on pillow 10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
TyRoyal committed Jan 6, 2024
1 parent ff421dc commit c409810
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ssrspeed/result/export_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ def __getMaxWidth(self,result):
remark = item["remarks"]
inres = item["InRes"]
outres = item["OutRes"]
maxGroupWidth = max(maxGroupWidth,draw.textsize(group,font=font)[0])
maxRemarkWidth = max(maxRemarkWidth,draw.textsize(remark,font=font)[0])
lenIn = max(lenIn, draw.textsize(inres, font=font)[0])
lenOut = max(lenOut, draw.textsize(outres, font=font)[0])
maxGroupWidth = max(maxGroupWidth,int(draw.textlength(group,font=font)))
maxRemarkWidth = max(maxRemarkWidth,int(draw.textlength(remark,font=font)))
lenIn = max(lenIn, int(draw.textlength(inres, font=font)))
lenOut = max(lenOut, int(draw.textlength(outres, font=font)))
return (maxGroupWidth + 10,maxRemarkWidth + 10,lenIn + 20,lenOut + 20)

def __getMaxWidthStream(self,result):
Expand Down Expand Up @@ -150,7 +150,7 @@ def __deweighting(self,result):
def __getBasePos(self, width, text):
font = self.__font
draw = ImageDraw.Draw(Image.new("RGB",(1,1),(255,255,255)))
textSize = draw.textsize(text, font=font)[0]
textSize = draw.textlength(text, font=font)
basePos = (width - textSize) / 2
logger.debug("Base Position {}".format(basePos))
return basePos
Expand Down

0 comments on commit c409810

Please sign in to comment.