Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Base Worker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Workers
Base Worker
Merge requests
!386
Bump Python requirement mkdocs-material to 9.4.6
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Bump Python requirement mkdocs-material to 9.4.6
bump-mkdocs-material
into
master
Overview
0
Commits
2
Pipelines
14
Changes
1
Merged
Teklia Bot
requested to merge
bump-mkdocs-material
into
master
1 year ago
Overview
0
Commits
2
Pipelines
14
Changes
8
Expand
0
0
Merge request reports
Compare
version 7
version 13
3864fb7a
1 year ago
version 12
fdd08324
1 year ago
version 11
475fbebf
1 year ago
version 10
73714c2e
1 year ago
version 9
f06772f3
1 year ago
version 8
c4329355
1 year ago
version 7
355ac8cf
1 year ago
version 6
6b385377
1 year ago
version 5
b00e93b6
1 year ago
version 4
4fc3405f
1 year ago
version 3
2aaf333e
1 year ago
version 2
38a25cf8
1 year ago
version 1
063d7fce
1 year ago
master (base)
and
version 10
latest version
912791ec
2 commits,
1 year ago
version 13
3864fb7a
1 commit,
1 year ago
version 12
fdd08324
1 commit,
1 year ago
version 11
475fbebf
1 commit,
1 year ago
version 10
73714c2e
1 commit,
1 year ago
version 9
f06772f3
1 commit,
1 year ago
version 8
c4329355
1 commit,
1 year ago
version 7
355ac8cf
1 commit,
1 year ago
version 6
6b385377
1 commit,
1 year ago
version 5
b00e93b6
1 commit,
1 year ago
version 4
4fc3405f
1 commit,
1 year ago
version 3
2aaf333e
1 commit,
1 year ago
version 2
38a25cf8
1 commit,
1 year ago
version 1
063d7fce
1 commit,
1 year ago
Show latest version
8 files
+
209
−
67
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
8
Search (e.g. *.vue) (Ctrl+P)
arkindex_worker/cache.py
+
19
−
9
Options
@@ -102,14 +102,26 @@ class CachedElement(Model):
database
=
db
table_name
=
"
elements
"
def
open_image
(
self
,
*
args
,
max_size
:
Optional
[
int
]
=
None
,
**
kwargs
)
->
Image
:
def
open_image
(
self
,
*
args
,
max_width
:
Optional
[
int
]
=
None
,
max_height
:
Optional
[
int
]
=
None
,
**
kwargs
,
)
->
Image
:
"""
Open this element
'
s image as a Pillow image.
This does not crop the image to the element
'
s polygon.
IIIF servers with maxWidth, maxHeight or maxArea restrictions on image size are not supported.
Warns:
----
If both, ``max_width`` and ``max_height`` are set, the image ratio is not preserved.
:param *args: Positional arguments passed to [arkindex_worker.image.open_image][]
:param max_size: Subresolution of the image.
:param max_width: The maximum width of the image.
:param max_height: The maximum height of the image.
:param **kwargs: Keyword arguments passed to [arkindex_worker.image.open_image][]
:raises ValueError: When this element does not have an image ID or a polygon.
:return: A Pillow image.
@@ -129,7 +141,7 @@ class CachedElement(Model):
else
:
box
=
"
full
"
if
max_
size
is
None
:
if
max_
width
is
None
and
max_height
is
None
:
resize
=
"
full
"
else
:
# Do not resize for polygons that do not exactly match the images
@@ -141,14 +153,12 @@ class CachedElement(Model):
resize
=
"
full
"
# Do not resize when the image is below the maximum size
elif
self
.
image
.
width
<=
max_size
and
self
.
image
.
height
<=
max_size
:
elif
(
max_width
is
None
or
self
.
image
.
width
<=
max_width
)
and
(
max_height
is
None
or
self
.
image
.
height
<=
max_height
):
resize
=
"
full
"
else
:
ratio
=
max_size
/
max
(
self
.
image
.
width
,
self
.
image
.
height
)
new_width
,
new_height
=
int
(
self
.
image
.
width
*
ratio
),
int
(
self
.
image
.
height
*
ratio
)
resize
=
f
"
{
new_width
}
,
{
new_height
}
"
resize
=
f
"
{
max_width
or
''
}
,
{
max_height
or
''
}
"
url
=
self
.
image
.
url
if
not
url
.
endswith
(
"
/
"
):
Loading