Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Tasks
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Arkindex
Tasks
Commits
fa50ccf0
Commit
fa50ccf0
authored
1 year ago
by
Valentin Rigal
Committed by
Erwan Rouchet
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Always convert images to RGB mode on Transkribus imports
parent
06a3bfd4
No related branches found
No related tags found
1 merge request
!366
Always convert images to RGB mode on Transkribus imports
Pipeline
#141841
passed
1 year ago
Stage: test
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arkindex_tasks/import_files/transkribus.py
+3
-8
3 additions, 8 deletions
arkindex_tasks/import_files/transkribus.py
with
3 additions
and
8 deletions
arkindex_tasks/import_files/transkribus.py
+
3
−
8
View file @
fa50ccf0
...
...
@@ -23,10 +23,6 @@ from arkindex_tasks.utils import default_client, retried_request
logging
.
basicConfig
(
format
=
"
[%(levelname)s] %(message)s
"
,
level
=
logging
.
INFO
)
logger
=
logging
.
getLogger
(
__name__
)
# Image formats that should not be converted before uploading
# see https://pillow.readthedocs.io/en/5.1.x/handbook/image-file-formats.html
VALID_IMAGE_FORMATS
=
[
"
JPEG
"
,
"
JPEG2000
"
,
"
PNG
"
]
def
hash_file
(
path
)
->
str
:
md5
=
hashlib
.
md5
()
...
...
@@ -70,10 +66,9 @@ class TranskribusElement(object):
shutil
.
copyfileobj
(
source
,
destination
)
with
Image
.
open
(
img_path
)
as
img
:
if
img
.
format
not
in
VALID_IMAGE_FORMATS
:
# Convert to RGB if needed
if
img
.
mode
!=
"
RGB
"
:
img
=
img
.
convert
(
"
RGB
"
)
# Convert to RGB if needed
if
img
.
mode
!=
"
RGB
"
:
img
=
img
.
convert
(
"
RGB
"
)
# Apply the rotation/transposition from the EXIF orientation tag if it is used
img
=
ImageOps
.
exif_transpose
(
img
)
...
...
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