mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 13:14:27 +03:00
Fix priority when selecting j2k kind
This commit is contained in:
parent
de26f78eb1
commit
f8a74cbed1
|
@ -215,6 +215,18 @@ def test_use_jp2():
|
|||
out.seek(0)
|
||||
assert out.read(2) == b"\xff\x4f"
|
||||
|
||||
out = BytesIO()
|
||||
out.name = "foo.j2k"
|
||||
test_card.save(out, "JPEG2000", use_jp2=False)
|
||||
out.seek(0)
|
||||
assert out.read(2) == b"\xff\x4f"
|
||||
|
||||
out = BytesIO()
|
||||
out.name = "foo.jp2"
|
||||
test_card.save(out, "JPEG2000", use_jp2=False)
|
||||
out.seek(4)
|
||||
assert out.read(2) != b"jP"
|
||||
|
||||
|
||||
def test_mct():
|
||||
# Three component
|
||||
|
|
|
@ -290,13 +290,13 @@ def _accept(prefix):
|
|||
|
||||
|
||||
def _save(im, fp, filename):
|
||||
# Get the keyword arguments
|
||||
info = im.encoderinfo
|
||||
|
||||
if filename.endswith(".j2k"):
|
||||
kind = "j2k"
|
||||
else:
|
||||
kind = "jp2"
|
||||
|
||||
# Get the keyword arguments
|
||||
info = im.encoderinfo
|
||||
kind = "jp2" if info.get("use_jp2", True) else "j2k"
|
||||
|
||||
offset = info.get("offset", None)
|
||||
tile_offset = info.get("tile_offset", None)
|
||||
|
@ -321,9 +321,6 @@ def _save(im, fp, filename):
|
|||
progression = info.get("progression", "LRCP")
|
||||
cinema_mode = info.get("cinema_mode", "no")
|
||||
mct = info.get("mct", 0)
|
||||
|
||||
kind = "jp2" if info.get("use_jp2", True) else "j2k"
|
||||
|
||||
fd = -1
|
||||
|
||||
if hasattr(fp, "fileno"):
|
||||
|
|
Loading…
Reference in New Issue
Block a user