Skip to content

Commit

Permalink
Bugfix/pillow10: Not compatible with Pillow=10.0.0 #31 (#32)
Browse files Browse the repository at this point in the history
* open with encoding
* Update draw_gpx.py
* ImageDraw.textlength() instead of deprecated method ImageDraw.textsize()
* use ImageDraw.textbbox() to retrieve the textbox height

---------

Co-authored-by: Lowtower <[email protected]>
  • Loading branch information
lowtower and Lowtower authored Apr 9, 2024
1 parent 1f21020 commit 39a5750
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion staticmaps/pillow_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@ def render_attribution(self, attribution: typing.Optional[str]) -> None:
if (attribution is None) or (attribution == ""):
return
margin = 2
_, th = self.draw().textsize(attribution)
w = self._trans.image_width()
h = self._trans.image_height()
left, top, right, bottom = self.draw().textbbox((margin, h - margin), attribution)
th = bottom - top
overlay = PIL_Image.new("RGBA", self._image.size, (255, 255, 255, 0))
draw = PIL_ImageDraw.Draw(overlay)
draw.rectangle([(0, h - th - 2 * margin), (w, h)], fill=(255, 255, 255, 204))
Expand Down

0 comments on commit 39a5750

Please sign in to comment.