--- tiff/configure	2013-11-21 17:03:14.000000000 -0500
+++ tiff/configure	2014-06-09 14:00:22.000000000 -0400
@@ -8232,5 +8232,5 @@
 
 
-    vars="tiff.c tiffJpeg.c tiffZip.c tiffPixar.c"
+    vars="tiff.c"
     for i in $vars; do
 	case $i in
--- tiff/tiff.c	2019-03-02 16:33:00.000000000 -0500
+++ tiff/tiff.c	2020-01-20 21:20:18.135776000 -0500
@@ -19,11 +19,15 @@
 #endif
 #include "tkimg.h"
-#include "tifftcl.h"
-#include "zlibtcl.h"
+#ifdef EXTERN
+#	undef EXTERN
+#endif
+#include <tiff.h>
+#include <tiffio.h>
+#include <zlib.h>
 
 #ifdef HAVE_STDLIB_H
 #undef HAVE_STDLIB_H
 #endif
-#include "jpegtcl.h"
+#include <jpeglib.h>
 
 
@@ -35,7 +39,4 @@
 #include "init.c"
 
-#include "tiffInt.h"
-
-
 extern DLLIMPORT int unlink(const char *);
 
@@ -88,52 +89,11 @@
     Tcl_Interp *interp;
 {
-    static int initialized = 0;
-
-    if (Tifftcl_InitStubs(interp, TIFFTCL_VERSION, 0) == NULL) {
-        return TCL_ERROR;
-    }
-
     if (errorMessage) {
 	ckfree(errorMessage);
 	errorMessage = NULL;
     }
-    if (TIFFSetErrorHandler != NULL) {
-        TIFFSetErrorHandler(_TIFFerr);
-    }
-    if (TIFFSetWarningHandler != NULL) {
-	TIFFSetWarningHandler(_TIFFwarn);
-    }
-
-    /*
-     * Initialize jpeg and zlib too, for use by the CODEC's we register
-     * with the base TIFF library in this package.
-     */
-
-    if (Jpegtcl_InitStubs(interp, JPEGTCL_VERSION, 0) == NULL) {
-        return TCL_ERROR;
-    }
-
-    if (!initialized) {
-	initialized = 1;
-	if (
-	    TIFFRegisterCODEC   && TIFFError        && TIFFPredictorInit &&
-	    _TIFFMergeFieldInfo  && TIFFFlushData1   && _TIFFNoPostDecode &&
-	    TIFFTileRowSize     && TIFFScanlineSize && _TIFFsetByteArray &&
-	    TIFFVSetField       && TIFFSwabArrayOfShort
-	    ) {
-
-	  if (Zlibtcl_InitStubs(interp, ZLIBTCL_VERSION, 0) == NULL) {
-	    return TCL_ERROR;
-	  }
-	  TIFFRegisterCODEC (COMPRESSION_DEFLATE,  "Deflate",  TkimgTIFFInitZip);
-	  TIFFRegisterCODEC (COMPRESSION_ADOBE_DEFLATE, "AdobeDeflate", TkimgTIFFInitZip);
+    TIFFSetErrorHandler(_TIFFerr);
+    TIFFSetWarningHandler(_TIFFwarn);
 
-	  if (Jpegtcl_InitStubs(interp, JPEGTCL_VERSION, 0) == NULL) {
-	    return TCL_ERROR;
-	  }
-	  TIFFRegisterCODEC (COMPRESSION_JPEG,     "JPEG",     TkimgTIFFInitJpeg);
-	  TIFFRegisterCODEC (COMPRESSION_PIXARLOG, "PixarLog", TkimgTIFFInitPixar);
-	}
-    }
     return TCL_OK;
 }
@@ -451,9 +411,6 @@
 {
     TIFF *tif;
-    char *tempFileName = NULL, tempFileNameBuffer[256];
-    size_t count;
     int result;
     tkimg_MFile handle;
-    char buffer[1024];
     char *dataPtr = NULL;
 
@@ -462,35 +419,13 @@
     }
 
-    if (TIFFClientOpen) {
-	if (handle.state != IMG_STRING) {
-	    dataPtr = ckalloc((handle.length*3)/4 + 2);
-	    handle.length = tkimg_Read2(&handle, dataPtr, handle.length);
-	    handle.data = dataPtr;
-	}
-	handle.state = 0;
-	tif = TIFFClientOpen("inline data", "r", (thandle_t) &handle,
-		readString, writeString, seekString, closeDummy,
-		sizeString, mapDummy, unMapDummy);
-    } else {
-	Tcl_Channel outchan;
-	tempFileName = tmpnam(tempFileNameBuffer);
-	outchan = tkimg_OpenFileChannel(interp, tempFileName, 0644);
-	if (!outchan) {
-	    return TCL_ERROR;
-	}
-
-	count = (size_t)tkimg_Read2(&handle, buffer, 1024);
-	while (count == 1024) {
-	    Tcl_Write(outchan, buffer, count);
-	    count = (size_t)tkimg_Read2(&handle, buffer, 1024);
-	}
-	if (count + 1 > 1){
-	    Tcl_Write(outchan, buffer, count);
-	}
-	if (Tcl_Close(interp, outchan) == TCL_ERROR) {
-	    return TCL_ERROR;
-	}
-	tif = TIFFOpen(tempFileName, "r");
-    }
+    if (handle.state != IMG_STRING) {
+       dataPtr = ckalloc((handle.length*3)/4 + 2);
+       handle.length = tkimg_Read(&handle, dataPtr, handle.length);
+       handle.data = dataPtr;
+    }
+    handle.state = 0;
+    tif = TIFFClientOpen("inline data", "r", (thandle_t) &handle,
+       readString, writeString, seekString, closeDummy,
+       sizeString, mapDummy, unMapDummy);
 
     if (tif != NULL) {
@@ -500,7 +435,4 @@
 	result = TCL_ERROR;
     }
-    if (tempFileName) {
-	unlink(tempFileName);
-    }
     if (result == TCL_ERROR) {
 	Tcl_AppendResult(interp, errorMessage, (char *) NULL);
@@ -527,38 +459,12 @@
 {
     TIFF *tif;
-    char *tempFileName = NULL, tempFileNameBuffer[256];
-    size_t count;
-    int result;
-    char buffer[1024];
-
-    if (TIFFClientOpen) {
-	tkimg_MFile handle;
-	handle.data = (char *) chan;
-	handle.state = IMG_CHAN;
-	tif = TIFFClientOpen(fileName, "r", (thandle_t) &handle,
-		readMFile, writeDummy, seekMFile, closeDummy,
-		sizeMFile, mapDummy, unMapDummy);
-    } else {
-	Tcl_Channel outchan;
-	tempFileName = tmpnam(tempFileNameBuffer);
-	outchan = tkimg_OpenFileChannel(interp, tempFileName, 0644);
-	if (!outchan) {
-	    return TCL_ERROR;
-	}
+    int	result;
+    tkimg_MFile	handle;
 
-	count = (size_t)Tcl_Read(chan, buffer, 1024);
-	while (count == 1024) {
-	    Tcl_Write(outchan, buffer, count);
-	    count = (size_t)Tcl_Read(chan, buffer, 1024);
-	}
-	if (count + 1 > 1){
-	    Tcl_Write(outchan, buffer, count);
-	}
-	if (Tcl_Close(interp, outchan) == TCL_ERROR) {
-	    return TCL_ERROR;
-	}
-
-	tif = TIFFOpen(tempFileName, "r");
-    }
+    handle.data = (char *) chan;
+    handle.state = IMG_CHAN;
+    tif = TIFFClientOpen(fileName, "r", (thandle_t) &handle,
+       readMFile, writeDummy, seekMFile, closeDummy,
+       sizeMFile, mapDummy, unMapDummy);
     if (tif) {
 	result = CommonRead(interp, tif, format, imageHandle,
@@ -567,7 +473,4 @@
 	result = TCL_ERROR;
     }
-    if (tempFileName) {
-	unlink(tempFileName);
-    }
     if (result == TCL_ERROR) {
 	Tcl_AppendResult(interp, errorMessage, (char *) NULL);
@@ -637,5 +540,5 @@
     npixels = w * h;
 
-    raster = (uint32*) TkimgTIFFmalloc(npixels * sizeof (uint32));
+    raster = (uint32*) _TIFFmalloc(npixels * sizeof (uint32));
     block.width = w;
     block.height = h;
@@ -648,5 +551,5 @@
 
     if (!TIFFReadRGBAImage(tif, w, h, raster, 0) || errorMessage) {
-        TkimgTIFFfree (raster);
+        _TIFFfree (raster);
 	if (errorMessage) {
 	    Tcl_AppendResult(interp, errorMessage, (char *) NULL);
@@ -665,5 +568,5 @@
     }
 
-    TkimgTIFFfree (raster);
+    _TIFFfree (raster);
     TIFFClose(tif);
     return result;
@@ -676,7 +579,6 @@
 ) {
     TIFF *tif;
-    int result, comp;
+    int result, comp, length;
     tkimg_MFile handle;
-    char *tempFileName = NULL, tempFileNameBuffer[256];
     Tcl_DString dstring;
     const char *mode;
@@ -688,14 +590,9 @@
     }
 
-    if (TIFFClientOpen) {
-	Tcl_DStringInit(&dstring);
-	tkimg_WriteInit(&dstring, &handle);
-	tif = TIFFClientOpen("inline data", mode, (thandle_t) &handle,
-		readString, writeString, seekString, closeDummy,
-		sizeString, mapDummy, unMapDummy);
-    } else {
-	tempFileName = tmpnam(tempFileNameBuffer);
-	tif = TIFFOpen(tempFileName,mode);
-    }
+    Tcl_DStringInit(&dstring);
+    tkimg_WriteInit(&dstring, &handle);
+    tif = TIFFClientOpen("inline data", mode, (thandle_t) &handle,
+	readString, writeString, seekString, closeDummy,
+	sizeString, mapDummy, unMapDummy);
 
     result = CommonWrite(interp, tif, comp, blockPtr);
@@ -703,7 +600,4 @@
 
     if (result != TCL_OK) {
-	if (tempFileName) {
-	    unlink(tempFileName);
-	}
 	Tcl_AppendResult(interp, errorMessage, (char *) NULL);
 	ckfree(errorMessage);
@@ -712,29 +606,8 @@
     }
 
-    if (tempFileName) {
-	Tcl_Channel inchan;
-	char buffer[1024];
-	inchan = tkimg_OpenFileChannel(interp, tempFileName, 0644);
-	if (!inchan) {
-	    return TCL_ERROR;
-	}
-	tkimg_WriteInit(&data, &handle);
-
-	result = Tcl_Read(inchan, buffer, 1024);
-	while ((result == TCL_OK) && !Tcl_Eof(inchan)) {
-	    tkimg_Write2(&handle, buffer, result);
-	    result = Tcl_Read(inchan, buffer, 1024);
-	}
-	if (result == TCL_OK) {
-	    tkimg_Write2(&handle, buffer, result);
-	    result = Tcl_Close(interp, inchan);
-	}
-	unlink(tempFileName);
-    } else {
-	int length = handle.length;
-	tkimg_WriteInit(&data, &handle);
-	tkimg_Write2(&handle, Tcl_DStringValue(&dstring), length);
-	Tcl_DStringFree(&dstring);
-    }
+    length = handle.length;
+    tkimg_WriteInit(&data, &handle);
+    tkimg_Write(&handle, Tcl_DStringValue(&dstring), length);
+    Tcl_DStringFree(&dstring);
     tkimg_Putc(IMG_DONE, &handle);
     if (result == TCL_OK) {
@@ -956,36 +829,2 @@
     return TCL_OK;
 }
-
-void
-TkimgTIFFfree (data)
-    tdata_t data;
-{
-    if (_TIFFfree) {
-	_TIFFfree(data);
-    } else {
-	ckfree((char *) data);
-    }
-}
-
-tdata_t
-TkimgTIFFmalloc(size)
-    tsize_t size;
-{
-    if (_TIFFmalloc) {
-	return _TIFFmalloc(size);
-    } else {
-	return ckalloc(size);
-    }
-}
-
-tdata_t
-TkimgTIFFrealloc(data, size)
-    tdata_t data;
-    tsize_t size;
-{
-    if (_TIFFrealloc) {
-	return _TIFFrealloc(data, size);
-    } else {
-	return ckrealloc(data, size);
-    }
-}
--- tests/tiff.test	2016-07-30 10:31:08.000000000 -0400
+++ tests/tiff.test	2020-01-20 21:44:30.430340000 -0500
@@ -22,5 +22,5 @@
     source $file.base64
 
-    test tiff-1.1 {} -setup {
+    test tiff-1.1 {} -constraints nonPortable -setup {
         catch {image delete i}
     } -body {
@@ -31,5 +31,5 @@
     } -result $imgdata
 
-    test tiff-1.2 {} -setup {
+    test tiff-1.2 {} -constraints nonPortable -setup {
         catch {image delete i}
     } -body {
@@ -40,5 +40,5 @@
     } -result $imgdata
 
-    test tiff-1.3 {} -setup {
+    test tiff-1.3 {} -constraints nonPortable -setup {
         catch {image delete i}
     } -body {
@@ -50,5 +50,5 @@
     } -result $imgdata
 
-    test tiff-1.4 {} -setup {
+    test tiff-1.4 {} -constraints nonPortable -setup {
         catch {image delete i}
     } -body {
