diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp
index 8f3d3e4..de91219 100644
--- a/src/plugins/imageformats/tiff/qtiffhandler.cpp
+++ b/src/plugins/imageformats/tiff/qtiffhandler.cpp
@@ -556,17 +556,19 @@ bool QTiffHandler::write(const QImage &image)
         uint16 photometric = PHOTOMETRIC_MINISBLACK;
         if (image.colorTable().at(0) == 0xffffffff)
             photometric = PHOTOMETRIC_MINISWHITE;
+
+        // try to do the conversion in chunks no greater than 16 MB
+        int chunks = (width * height / (1024 * 1024 * 16)) + 1;
+        int chunkHeight = qMax(height / chunks, 1);
+
         if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, photometric)
             || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_LZW)
-            || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 1)) {
+            || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 1)
+            || !TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIP, chunkHeight)) {
             TIFFClose(tiff);
             return false;
         }
 
-        // try to do the conversion in chunks no greater than 16 MB
-        int chunks = (width * height / (1024 * 1024 * 16)) + 1;
-        int chunkHeight = qMax(height / chunks, 1);
-
         int y = 0;
         while (y < height) {
             QImage chunk = image.copy(0, y, width, qMin(chunkHeight, height - y)).convertToFormat(QImage::Format_Mono);
@@ -587,20 +589,27 @@ bool QTiffHandler::write(const QImage &image)
                || format == QImage::Format_Alpha8) {
         QVector<QRgb> colorTable = effectiveColorTable(image);
         bool isGrayscale = checkGrayscale(colorTable);
+
+        // try to do the conversion in chunks no greater than 16 MB
+        int chunks = (width * height/ (1024 * 1024 * 16)) + 1;
+        int chunkHeight = qMax(height / chunks, 1);
+
         if (isGrayscale) {
             uint16 photometric = PHOTOMETRIC_MINISBLACK;
             if (colorTable.at(0) == 0xffffffff)
                 photometric = PHOTOMETRIC_MINISWHITE;
             if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, photometric)
                     || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_LZW)
-                    || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) {
+                    || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)
+                    || !TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIP, chunkHeight)) {
                 TIFFClose(tiff);
                 return false;
             }
         } else {
             if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE)
                     || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_LZW)
-                    || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) {
+                    || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)
+                    || !TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIP, chunkHeight)) {
                 TIFFClose(tiff);
                 return false;
             }
@@ -629,9 +638,6 @@ bool QTiffHandler::write(const QImage &image)
         }
 
         //// write the data
-        // try to do the conversion in chunks no greater than 16 MB
-        int chunks = (width * height/ (1024 * 1024 * 16)) + 1;
-        int chunkHeight = qMax(height / chunks, 1);
 
         int y = 0;
         while (y < height) {
@@ -649,16 +655,18 @@ bool QTiffHandler::write(const QImage &image)
         }
         TIFFClose(tiff);
     } else if (!image.hasAlphaChannel()) {
+        // try to do the RGB888 conversion in chunks no greater than 16 MB
+        const int chunks = (width * height * 3 / (1024 * 1024 * 16)) + 1;
+        const int chunkHeight = qMax(height / chunks, 1);
+
         if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB)
             || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_LZW)
             || !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 3)
-            || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) {
+            || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)
+            || !TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIP, chunkHeight)) {
             TIFFClose(tiff);
             return false;
         }
-        // try to do the RGB888 conversion in chunks no greater than 16 MB
-        const int chunks = (width * height * 3 / (1024 * 1024 * 16)) + 1;
-        const int chunkHeight = qMax(height / chunks, 1);
 
         int y = 0;
         while (y < height) {
@@ -679,17 +687,20 @@ bool QTiffHandler::write(const QImage &image)
         const bool premultiplied = image.format() != QImage::Format_ARGB32
                                 && image.format() != QImage::Format_RGBA8888;
         const uint16 extrasamples = premultiplied ? EXTRASAMPLE_ASSOCALPHA : EXTRASAMPLE_UNASSALPHA;
+
+        // try to do the RGBA8888 conversion in chunks no greater than 16 MB
+        const int chunks = (width * height * 4 / (1024 * 1024 * 16)) + 1;
+        const int chunkHeight = qMax(height / chunks, 1);
+
         if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB)
             || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_LZW)
             || !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 4)
             || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)
-            || !TIFFSetField(tiff, TIFFTAG_EXTRASAMPLES, 1, &extrasamples)) {
+            || !TIFFSetField(tiff, TIFFTAG_EXTRASAMPLES, 1, &extrasamples)
+            || !TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIP, chunkHeight)) {
             TIFFClose(tiff);
             return false;
         }
-        // try to do the RGBA8888 conversion in chunks no greater than 16 MB
-        const int chunks = (width * height * 4 / (1024 * 1024 * 16)) + 1;
-        const int chunkHeight = qMax(height / chunks, 1);
 
         const QImage::Format format = premultiplied ? QImage::Format_RGBA8888_Premultiplied
                                                     : QImage::Format_RGBA8888;
