mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-04 11:53:32 +03:00
Fix setting of TIFF ExtraSamples tag.
- force cast ExtraSamples to a list. - fix calls to ImagingLibTiffSetField to include array length.
This commit is contained in:
parent
21459e9ab4
commit
aba7a34036
|
@ -1183,6 +1183,8 @@ def _save(im, fp, filename):
|
||||||
atts = {}
|
atts = {}
|
||||||
# bits per sample is a single short in the tiff directory, not a list.
|
# bits per sample is a single short in the tiff directory, not a list.
|
||||||
atts[BITSPERSAMPLE] = bits[0]
|
atts[BITSPERSAMPLE] = bits[0]
|
||||||
|
if EXTRASAMPLES in ifd:
|
||||||
|
atts[EXTRASAMPLES] = list(ifd[EXTRASAMPLES])
|
||||||
# Merge the ones that we have with (optional) more bits from
|
# Merge the ones that we have with (optional) more bits from
|
||||||
# the original file, e.g x,y resolution so that we can
|
# the original file, e.g x,y resolution so that we can
|
||||||
# save(load('')) == original file.
|
# save(load('')) == original file.
|
||||||
|
|
4
encode.c
4
encode.c
|
@ -770,7 +770,7 @@ PyImaging_LibTiffEncoderNew(PyObject* self, PyObject* args)
|
||||||
}
|
}
|
||||||
status = ImagingLibTiffSetField(&encoder->state,
|
status = ImagingLibTiffSetField(&encoder->state,
|
||||||
(ttag_t) PyInt_AsLong(key),
|
(ttag_t) PyInt_AsLong(key),
|
||||||
intav);
|
len, intav);
|
||||||
free(intav);
|
free(intav);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -782,7 +782,7 @@ PyImaging_LibTiffEncoderNew(PyObject* self, PyObject* args)
|
||||||
}
|
}
|
||||||
status = ImagingLibTiffSetField(&encoder->state,
|
status = ImagingLibTiffSetField(&encoder->state,
|
||||||
(ttag_t) PyInt_AsLong(key),
|
(ttag_t) PyInt_AsLong(key),
|
||||||
floatav);
|
len, floatav);
|
||||||
free(floatav);
|
free(floatav);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user