Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
743c0274
Commit
743c0274
authored
Aug 26, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added patch from John Corey for PNG 1.2.
parent
67683b19
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
lib/python/OFS/Image.py
lib/python/OFS/Image.py
+13
-1
No files found.
lib/python/OFS/Image.py
View file @
743c0274
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""Image object"""
__version__
=
'$Revision: 1.8
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.8
3
$'
[
11
:
-
2
]
import
Globals
,
string
,
struct
,
content_types
from
OFS.content_types
import
guess_content_type
...
...
@@ -435,6 +435,18 @@ class Image(File):
except
:
pass
# handle PNGs
# Someone says this is the right thing:
# Re: PNG v1.2 spec (http://www.cdrom.com/pub/png/spec/)
# Bytes 0-7 are below, 4-byte chunk length, then 'IHDR'
# and finally the 4-byte width, height
elif
(
size
>=
24
)
and
(
data
[:
8
]
==
'
\
211
PNG
\
r
\
n
\
032
\
n
'
)
\
and
(
data
[
12
:
16
]
==
'IHDR'
):
w
,
h
=
struct
.
unpack
(
">LL"
,
data
[
16
:
24
])
# But we had this before. I have no clue, so I'll keep both. :)
# Maybe this is for an older PNG version.
elif
(
size
>=
16
)
and
(
data
[:
8
]
==
'
\
x89
PNG
\
r
\
n
\
x1a
\
n
'
):
w
,
h
=
struct
.
unpack
(
">LL"
,
data
[
8
:
16
])
self
.
width
=
str
(
int
(
w
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment