mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +03:00
Merge pull request #8529 from radarhere/tiff_tags
This commit is contained in:
commit
99ee337e07
|
@ -1914,7 +1914,9 @@ def _save(im: Image.Image, fp: IO[bytes], filename: str | bytes) -> None:
|
||||||
if not getattr(Image.core, "libtiff_support_custom_tags", False):
|
if not getattr(Image.core, "libtiff_support_custom_tags", False):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if tag in ifd.tagtype:
|
if tag in TiffTags.TAGS_V2_GROUPS:
|
||||||
|
types[tag] = TiffTags.LONG8
|
||||||
|
elif tag in ifd.tagtype:
|
||||||
types[tag] = ifd.tagtype[tag]
|
types[tag] = ifd.tagtype[tag]
|
||||||
elif not (isinstance(value, (int, float, str, bytes))):
|
elif not (isinstance(value, (int, float, str, bytes))):
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -736,7 +736,7 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
|
||||||
}
|
}
|
||||||
if (tag_type) {
|
if (tag_type) {
|
||||||
int type_int = PyLong_AsLong(tag_type);
|
int type_int = PyLong_AsLong(tag_type);
|
||||||
if (type_int >= TIFF_BYTE && type_int <= TIFF_DOUBLE) {
|
if (type_int >= TIFF_BYTE && type_int <= TIFF_LONG8) {
|
||||||
type = (TIFFDataType)type_int;
|
type = (TIFFDataType)type_int;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -929,7 +929,7 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
|
||||||
);
|
);
|
||||||
} else if (type == TIFF_LONG) {
|
} else if (type == TIFF_LONG) {
|
||||||
status = ImagingLibTiffSetField(
|
status = ImagingLibTiffSetField(
|
||||||
&encoder->state, (ttag_t)key_int, PyLong_AsLongLong(value)
|
&encoder->state, (ttag_t)key_int, (UINT32)PyLong_AsLong(value)
|
||||||
);
|
);
|
||||||
} else if (type == TIFF_SSHORT) {
|
} else if (type == TIFF_SSHORT) {
|
||||||
status = ImagingLibTiffSetField(
|
status = ImagingLibTiffSetField(
|
||||||
|
@ -959,6 +959,10 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
|
||||||
status = ImagingLibTiffSetField(
|
status = ImagingLibTiffSetField(
|
||||||
&encoder->state, (ttag_t)key_int, (FLOAT64)PyFloat_AsDouble(value)
|
&encoder->state, (ttag_t)key_int, (FLOAT64)PyFloat_AsDouble(value)
|
||||||
);
|
);
|
||||||
|
} else if (type == TIFF_LONG8) {
|
||||||
|
status = ImagingLibTiffSetField(
|
||||||
|
&encoder->state, (ttag_t)key_int, (uint64_t)PyLong_AsLongLong(value)
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
TRACE(
|
TRACE(
|
||||||
("Unhandled type for key %d : %s \n",
|
("Unhandled type for key %d : %s \n",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user