Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
plotID_python
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
plotID
plotID_python
Commits
06c8b159
Commit
06c8b159
authored
1 year ago
by
Mayr, Hannes
Browse files
Options
Downloads
Patches
Plain Diff
Switch from textsize to textbbox, since it is deprecated in Pillow 10.
parent
a3c3432d
No related branches found
No related tags found
2 merge requests
!74
Resolve "'ImageDraw' object has no attribute 'textsize'"
,
!73
Small documentation improvements and dependency updates
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
plotid/tagplot_image.py
+4
-2
4 additions, 2 deletions
plotid/tagplot_image.py
with
4 additions
and
2 deletions
plotid/tagplot_image.py
+
4
−
2
View file @
06c8b159
...
...
@@ -68,10 +68,12 @@ def tagplot_image(plotid_object: PlotOptions) -> PlotIDTransfer:
# Create temporary PIL image to get correct textsize
tmp_img
=
Image
.
new
(
"
L
"
,
(
100
,
100
))
tmp_draw
=
ImageDraw
.
Draw
(
tmp_img
)
textsize
=
tmp_draw
.
text
size
(
img_id
,
font
)
_
,
_
,
textwidth
,
textheight
=
tmp_draw
.
text
bbox
((
0
,
0
),
img_id
,
font
)
# Create new image with white background and the size of the textbox
img_txt
=
Image
.
new
(
"
RGBA
"
,
textsize
,
color
=
(
255
,
255
,
255
,
0
))
img_txt
=
Image
.
new
(
"
RGBA
"
,
(
textwidth
,
textheight
),
color
=
(
255
,
255
,
255
,
0
)
)
draw_txt
=
ImageDraw
.
Draw
(
img_txt
)
draw_txt
.
text
((
0
,
0
),
img_id
,
font
=
font
,
fill
=
color
)
# Rotate the image by the given angle
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment