Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fslpy
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
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
FSL
fslpy
Commits
11c558b4
Commit
11c558b4
authored
3 years ago
by
Paul McCarthy
Browse files
Options
Downloads
Patches
Plain Diff
MNT: Rudimentary support for JPEG 2000. Would be better to automatically infer
type
parent
8d1f3fa3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fsl/data/bitmap.py
+11
-5
11 additions, 5 deletions
fsl/data/bitmap.py
with
11 additions
and
5 deletions
fsl/data/bitmap.py
+
11
−
5
View file @
11c558b4
...
@@ -22,7 +22,8 @@ log = logging.getLogger(__name__)
...
@@ -22,7 +22,8 @@ log = logging.getLogger(__name__)
BITMAP_EXTENSIONS
=
[
'
.bmp
'
,
'
.png
'
,
'
.jpg
'
,
'
.jpeg
'
,
BITMAP_EXTENSIONS
=
[
'
.bmp
'
,
'
.png
'
,
'
.jpg
'
,
'
.jpeg
'
,
'
.tif
'
,
'
.tiff
'
,
'
.gif
'
,
'
.rgba
'
]
'
.tif
'
,
'
.tiff
'
,
'
.gif
'
,
'
.rgba
'
,
'
.jp2
'
,
'
.jpg2
'
,
'
.jp2k
'
]
"""
File extensions we understand.
"""
"""
File extensions we understand.
"""
...
@@ -34,7 +35,10 @@ BITMAP_DESCRIPTIONS = [
...
@@ -34,7 +35,10 @@ BITMAP_DESCRIPTIONS = [
'
TIFF
'
,
'
TIFF
'
,
'
TIFF
'
,
'
TIFF
'
,
'
Graphics Interchange Format
'
,
'
Graphics Interchange Format
'
,
'
Raw RGBA
'
]
'
Raw RGBA
'
,
'
JPEG 2000
'
,
'
JPEG 2000
'
,
'
JPEG 2000
'
]
"""
A description for each :attr:`BITMAP_EXTENSION`.
"""
"""
A description for each :attr:`BITMAP_EXTENSION`.
"""
...
@@ -54,9 +58,11 @@ class Bitmap(object):
...
@@ -54,9 +58,11 @@ class Bitmap(object):
if
isinstance
(
bmp
,
(
pathlib
.
Path
,
str
)):
if
isinstance
(
bmp
,
(
pathlib
.
Path
,
str
)):
try
:
try
:
# Allow big images
# Allow big/truncated images
import
PIL.Image
as
Image
import
PIL.Image
as
Image
Image
.
MAX_IMAGE_PIXELS
=
1e9
import
PIL.ImageFile
as
ImageFile
Image
.
MAX_IMAGE_PIXELS
=
None
ImageFile
.
LOAD_TRUNCATED_IMAGES
=
True
except
ImportError
:
except
ImportError
:
raise
RuntimeError
(
'
Install Pillow to use the Bitmap class
'
)
raise
RuntimeError
(
'
Install Pillow to use the Bitmap class
'
)
...
...
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