mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-04 06:16:19 +03:00
Fixed big-endian saving
This commit is contained in:
parent
10669b17b9
commit
a618e2ca1c
|
@ -336,21 +336,21 @@ def _save(im, fp, filename):
|
|||
)
|
||||
|
||||
# Header
|
||||
fp.write(struct.pack("i", MAGIC)[::-1])
|
||||
fp.write(struct.pack("i", file_size)[::-1])
|
||||
fp.write(struct.pack("<i", MAGIC)[::-1])
|
||||
fp.write(struct.pack("<i", file_size)[::-1])
|
||||
|
||||
# TOC
|
||||
toc_size = HEADER_SIZE + (len(entries) * HEADER_SIZE)
|
||||
fp.write(struct.pack("i", to_int(TOC))[::-1])
|
||||
fp.write(struct.pack("i", toc_size)[::-1])
|
||||
fp.write(struct.pack("<i", to_int(TOC))[::-1])
|
||||
fp.write(struct.pack("<i", toc_size)[::-1])
|
||||
for e in entries:
|
||||
fp.write(struct.pack("i", to_int(e.get("type")))[::-1])
|
||||
fp.write(struct.pack("i", HEADER_SIZE + e.get("size"))[::-1])
|
||||
fp.write(struct.pack("<i", to_int(e.get("type")))[::-1])
|
||||
fp.write(struct.pack("<i", HEADER_SIZE + e.get("size"))[::-1])
|
||||
|
||||
# Data
|
||||
for index, e in enumerate(entries):
|
||||
fp.write(struct.pack("i", to_int(e.get("type")))[::-1])
|
||||
fp.write(struct.pack("i", HEADER_SIZE + e.get("size"))[::-1])
|
||||
fp.write(struct.pack("<i", to_int(e.get("type")))[::-1])
|
||||
fp.write(struct.pack("<i", HEADER_SIZE + e.get("size"))[::-1])
|
||||
fp.write(e.get("stream").getvalue())
|
||||
|
||||
fp.flush()
|
||||
|
|
Loading…
Reference in New Issue
Block a user