@@ -736,7 +736,7 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
736736 }
737737 if (tag_type ) {
738738 int type_int = PyLong_AsLong (tag_type );
739- if (type_int >= TIFF_BYTE && type_int <= TIFF_DOUBLE ) {
739+ if (type_int >= TIFF_BYTE && type_int <= TIFF_LONG8 ) {
740740 type = (TIFFDataType )type_int ;
741741 }
742742 }
@@ -929,7 +929,7 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
929929 );
930930 } else if (type == TIFF_LONG ) {
931931 status = ImagingLibTiffSetField (
932- & encoder -> state , (ttag_t )key_int , PyLong_AsLongLong (value )
932+ & encoder -> state , (ttag_t )key_int , ( UINT32 ) PyLong_AsLong (value )
933933 );
934934 } else if (type == TIFF_SSHORT ) {
935935 status = ImagingLibTiffSetField (
@@ -959,6 +959,10 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
959959 status = ImagingLibTiffSetField (
960960 & encoder -> state , (ttag_t )key_int , (FLOAT64 )PyFloat_AsDouble (value )
961961 );
962+ } else if (type == TIFF_LONG8 ) {
963+ status = ImagingLibTiffSetField (
964+ & encoder -> state , (ttag_t )key_int , (uint64_t )PyLong_AsLongLong (value )
965+ );
962966 } else {
963967 TRACE (
964968 ("Unhandled type for key %d : %s \n" ,
0 commit comments