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:
Antony Lee 2014-12-28 21:47:16 +01:00 committed by wiredfool
parent 21459e9ab4
commit aba7a34036
2 changed files with 4 additions and 2 deletions

View File

@ -1183,6 +1183,8 @@ def _save(im, fp, filename):
atts = {}
# bits per sample is a single short in the tiff directory, not a list.
atts[BITSPERSAMPLE] = bits[0]
if EXTRASAMPLES in ifd:
atts[EXTRASAMPLES] = list(ifd[EXTRASAMPLES])
# Merge the ones that we have with (optional) more bits from
# the original file, e.g x,y resolution so that we can
# save(load('')) == original file.

View File

@ -770,7 +770,7 @@ PyImaging_LibTiffEncoderNew(PyObject* self, PyObject* args)
}
status = ImagingLibTiffSetField(&encoder->state,
(ttag_t) PyInt_AsLong(key),
intav);
len, intav);
free(intav);
}
} else {
@ -782,7 +782,7 @@ PyImaging_LibTiffEncoderNew(PyObject* self, PyObject* args)
}
status = ImagingLibTiffSetField(&encoder->state,
(ttag_t) PyInt_AsLong(key),
floatav);
len, floatav);
free(floatav);
}
}