Skip to content

Commit b1b0353

Browse files
committed
Corrected passing TIFF_LONG to libtiff
1 parent aa9ecac commit b1b0353

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Tests/test_file_libtiff.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,11 +668,16 @@ def test_save_ycbcr(self, tmp_path):
668668
assert reloaded.tag_v2[530] == (1, 1)
669669
assert reloaded.tag_v2[532] == (0, 255, 128, 255, 128, 255)
670670

671-
def test_save_imagesourcedata(self, tmp_path):
671+
def test_exif_ifd(self, tmp_path):
672672
outfile = str(tmp_path / "temp.tif")
673673
with Image.open("Tests/images/tiff_adobe_deflate.tif") as im:
674+
assert im.tag_v2[34665] == 125456
674675
im.save(outfile)
675676

677+
with Image.open(outfile) as reloaded:
678+
if Image.core.libtiff_support_custom_tags:
679+
assert reloaded.tag_v2[34665] == 125456
680+
676681
def test_crashing_metadata(self, tmp_path):
677682
# issue 1597
678683
with Image.open("Tests/images/rdf.tif") as im:

src/encode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,7 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
904904
&encoder->state, (ttag_t)key_int, (UINT16)PyLong_AsLong(value));
905905
} else if (type == TIFF_LONG) {
906906
status = ImagingLibTiffSetField(
907-
&encoder->state, (ttag_t)key_int, (UINT32)PyLong_AsLong(value));
907+
&encoder->state, (ttag_t)key_int, PyLong_AsLongLong(value));
908908
} else if (type == TIFF_SSHORT) {
909909
status = ImagingLibTiffSetField(
910910
&encoder->state, (ttag_t)key_int, (INT16)PyLong_AsLong(value));

0 commit comments

Comments
 (0)