diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 1064c16..c8d5976 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -652,8 +652,8 @@ bool QImageData::checkForAlphaPixels() const
     The following image formats are available in Qt. Values from Format_ARGB8565_Premultiplied
     to Format_ARGB4444_Premultiplied were added in Qt 4.4. Values Format_RGBX8888, Format_RGBA8888
     and Format_RGBA8888_Premultiplied were added in Qt 5.2. Values Format_BGR30, Format_A2BGR30_Premultiplied,
-    Format_RGB30, Format_A2RGB30_Premultiplied were added in Qt 5.4. Format_Alpha8 and Format_Grayscale8
-    were added in Qt 5.5.
+    Format_RGB30, Format_A2RGB30_Premultiplied were added in Qt 5.4. Format_Alpha8, Format_Grayscale8,
+    Format_Alpha16 and Format_Grayscale8 were added in Qt 5.5.
     See the notes after the table.
 
     \value Format_Invalid   The image is invalid.
@@ -711,6 +711,8 @@ bool QImageData::checkForAlphaPixels() const
     \value Format_A2RGB30_Premultiplied    The image is stored using a 32-bit premultiplied ARGB format (2-10-10-10).
     \value Format_Alpha8     The image is stored using an 8-bit alpha only format.
     \value Format_Grayscale8 The image is stored using an 8-bit grayscale format.
+    \value Format_Alpha16    The image is stored using an 16-bit alpha only format.
+    \value Format_Grayscale16 The image is stored using an 16-bit grayscale format.
 
     \note Drawing into a QImage with QImage::Format_Indexed8 is not
     supported.
@@ -2355,8 +2357,10 @@ bool QImage::allGray() const
         }
         return true;
     case Format_Alpha8:
+    case Format_Alpha16:
         return false;
     case Format_Grayscale8:
+    case Format_Grayscale16:
         return true;
     case Format_RGB32:
     case Format_ARGB32:
@@ -2422,10 +2426,10 @@ bool QImage::isGrayscale() const
     if (!d)
         return false;
 
-    if (d->format == QImage::Format_Alpha8)
+    if (d->format == QImage::Format_Alpha8 || d->format == QImage::Format_Alpha16)
         return false;
 
-    if (d->format == QImage::Format_Grayscale8)
+    if (d->format == QImage::Format_Grayscale8 || d->format == QImage::Format_Grayscale16)
         return true;
 
     switch (depth()) {
@@ -3013,6 +3017,8 @@ QImage QImage::rgbSwapped_helper() const
         break;
     case Format_Alpha8:
     case Format_Grayscale8:
+    case Format_Alpha16:
+    case Format_Grayscale16:
         return *this;
     case Format_Mono:
     case Format_MonoLSB:
@@ -3102,6 +3108,8 @@ void QImage::rgbSwapped_inplace()
         break;
     case Format_Alpha8:
     case Format_Grayscale8:
+    case Format_Alpha16:
+    case Format_Grayscale16:
         return;
     case Format_Mono:
     case Format_MonoLSB:
@@ -4110,7 +4118,7 @@ QImage QImage::alphaChannel() const
     if (!d)
         return QImage();
 
-    if (d->format == QImage::Format_Alpha8)
+    if (d->format == QImage::Format_Alpha8 || d->format == QImage::Format_Alpha16)
         return *this;
 
     int w = d->width;
@@ -4285,6 +4293,8 @@ static QImage rotated90(const QImage &image) {
     case QImage::Format_RGB555:
     case QImage::Format_RGB16:
     case QImage::Format_ARGB4444_Premultiplied:
+    case QImage::Format_Alpha16:
+    case QImage::Format_Grayscale16:
         qt_memrotate270(reinterpret_cast<const quint16*>(image.bits()),
                         w, h, image.bytesPerLine(),
                         reinterpret_cast<quint16*>(out.bits()),
@@ -4353,6 +4363,8 @@ static QImage rotated270(const QImage &image) {
     case QImage::Format_RGB555:
     case QImage::Format_RGB16:
     case QImage::Format_ARGB4444_Premultiplied:
+    case QImage::Format_Alpha16:
+    case QImage::Format_Grayscale16:
        qt_memrotate90(reinterpret_cast<const quint16*>(image.bits()),
                        w, h, image.bytesPerLine(),
                        reinterpret_cast<quint16*>(out.bits()),
@@ -4993,6 +5005,32 @@ static Q_CONSTEXPR QPixelFormat pixelformats[] = {
                     /*PREMULTIPLIED*/     QPixelFormat::NotPremultiplied,
                     /*INTERPRETATION*/    QPixelFormat::UnsignedByte,
                     /*BYTE ORDER*/        QPixelFormat::CurrentSystemEndian),
+        //QImage::Format_Alpha16:
+        QPixelFormat(QPixelFormat::Alpha,
+                    /*First*/              0,
+                    /*SECOND*/             0,
+                    /*THIRD*/              0,
+                    /*FOURTH*/             0,
+                    /*FIFTH*/              0,
+                    /*ALPHA*/              16,
+                    /*ALPHA USAGE*/       QPixelFormat::UsesAlpha,
+                    /*ALPHA POSITION*/    QPixelFormat::AtBeginning,
+                    /*PREMULTIPLIED*/     QPixelFormat::Premultiplied,
+                    /*INTERPRETATION*/    QPixelFormat::UnsignedByte,
+                    /*BYTE ORDER*/        QPixelFormat::CurrentSystemEndian),
+        //QImage::Format_Grayscale16:
+        QPixelFormat(QPixelFormat::Grayscale,
+                    /*GRAY*/               16,
+                    /*SECOND*/             0,
+                    /*THIRD*/              0,
+                    /*FOURTH*/             0,
+                    /*FIFTH*/              0,
+                    /*ALPHA*/              0,
+                    /*ALPHA USAGE*/       QPixelFormat::IgnoresAlpha,
+                    /*ALPHA POSITION*/    QPixelFormat::AtBeginning,
+                    /*PREMULTIPLIED*/     QPixelFormat::NotPremultiplied,
+                    /*INTERPRETATION*/    QPixelFormat::UnsignedByte,
+                    /*BYTE ORDER*/        QPixelFormat::CurrentSystemEndian),
 };
 Q_STATIC_ASSERT(sizeof(pixelformats) / sizeof(*pixelformats) == QImage::NImageFormats);
 
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 8984af1..67d744e 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -112,10 +112,8 @@ public:
         Format_A2RGB30_Premultiplied,
         Format_Alpha8,
         Format_Grayscale8,
-#if 0
-        // reserved for future use
+        Format_Alpha16,
         Format_Grayscale16,
-#endif
 #ifndef Q_QDOC
         NImageFormats
 #endif
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp
index 451d556..3de6be0 100644
--- a/src/gui/image/qimage_conversions.cpp
+++ b/src/gui/image/qimage_conversions.cpp
@@ -1764,7 +1764,7 @@ static bool convert_Grayscale8_to_Indexed8_inplace(QImageData *data, Qt::ImageCo
 Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormats] =
 {
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     },
     {
         0,
@@ -1785,7 +1785,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_Mono
 
     {
@@ -1807,7 +1807,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_MonoLSB
 
     {
@@ -1832,6 +1832,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0, 0, 0, 0, 0,
         convert_Indexed8_to_Alpha8,
         convert_Indexed8_to_Grayscale8,
+        0, 0
     }, // Format_Indexed8
 
     {
@@ -1858,7 +1859,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         convert_RGB_to_RGB30<PixelOrderBGR>,
         convert_RGB_to_RGB30<PixelOrderRGB>,
         convert_RGB_to_RGB30<PixelOrderRGB>,
-        0, 0
+        0, 0, 0, 0
     }, // Format_RGB32
 
     {
@@ -1885,7 +1886,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         convert_RGB_to_RGB30<PixelOrderRGB>,
         0,
-        0, 0
+        0, 0, 0, 0
     }, // Format_ARGB32
 
     {
@@ -1912,7 +1913,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
-        0, 0
+        0, 0, 0, 0
     },  // Format_ARGB32_Premultiplied
 
     {
@@ -1934,7 +1935,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGB16
 
     {
@@ -1956,7 +1957,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_ARGB8565_Premultiplied
 
     {
@@ -1978,7 +1979,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGB666
 
     {
@@ -2000,7 +2001,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_ARGB6666_Premultiplied
 
     {
@@ -2022,7 +2023,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGB555
 
     {
@@ -2044,7 +2045,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_ARGB8555_Premultiplied
 
     {
@@ -2066,7 +2067,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGB888
 
     {
@@ -2088,7 +2089,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGB444
 
     {
@@ -2109,7 +2110,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_ARGB4444_Premultiplied
     {
         0,
@@ -2131,7 +2132,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         mask_alpha_converter_RGBx,
         mask_alpha_converter_RGBx,
-        0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGBX8888
     {
         0,
@@ -2158,7 +2159,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
 #endif
-        0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGBA8888
 
     {
@@ -2180,7 +2181,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
-        0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGBA8888_Premultiplied
 
     {
@@ -2207,7 +2208,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         convert_passthrough,
         convert_BGR30_to_RGB30,
         convert_BGR30_to_RGB30,
-        0, 0
+        0, 0, 0, 0
     }, // Format_BGR30
     {
         0,
@@ -2233,7 +2234,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         convert_BGR30_to_RGB30,
-        0, 0
+        0, 0, 0, 0
     }, // Format_BGR30A2_Premultiplied
     {
         0,
@@ -2259,7 +2260,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         convert_passthrough,
-        0, 0
+        0, 0, 0, 0
     }, // Format_RGB30
     {
         0,
@@ -2287,6 +2288,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
+        0, 0
     }, // Format_RGB30A2_Premultiplied
     {
         0,
@@ -2306,7 +2308,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_Alpha8
     {
         0,
@@ -2326,20 +2328,30 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat
         0,
         0,
         0,
-        0, 0, 0, 0, 0, 0, 0
-    } // Format_Grayscale8
+        0, 0, 0, 0, 0, 0, 0, 0, 0
+    }, // Format_Grayscale8
+    {
+        0, 0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0
+    }, // Format_Alpha16
+    {
+        0, 0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0
+    } // Format_Grayscale16
 };
 
 InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats] =
 {
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     },
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_Mono
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_MonoLSB
     {
         0,
@@ -2363,6 +2375,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
         0, 0, 0, 0, 0,
         convert_Indexed8_to_Alpha8_inplace,
         convert_Indexed8_to_Grayscale8_inplace,
+        0, 0
     }, // Format_Indexed8
     {
         0,
@@ -2384,7 +2397,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
         0,
         0,
         0,
-        0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGB32
     {
         0,
@@ -2410,7 +2423,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
         0,
         convert_ARGB_to_RGBA_inplace,
         0,
-        0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_ARGB32
     {
         0,
@@ -2432,34 +2445,34 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
         0,
         0,
         convert_ARGB_to_RGBA_inplace,
-        0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0
     },  // Format_ARGB32_Premultiplied
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGB16
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_ARGB8565_Premultiplied
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGB666
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_ARGB6666_Premultiplied
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGB555
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_ARGB8555_Premultiplied
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGB888
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGB444
     {
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_ARGB4444_Premultiplied
     {
         0,
@@ -2481,7 +2494,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
         0,
         convert_passthrough_inplace<QImage::Format_RGBA8888>,
         convert_passthrough_inplace<QImage::Format_RGBA8888_Premultiplied>,
-        0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGBX8888
     {
         0,
@@ -2508,7 +2521,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
         0,
         0,
 #endif
-        0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGBA8888
     {
         0,
@@ -2517,7 +2530,6 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
         0,
         0,
         0,
-        0,
         convert_RGBA_to_ARGB_inplace<QImage::Format_ARGB32_Premultiplied>,
         0,
         0,
@@ -2530,7 +2542,8 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
         0,
         0,
         0,
-        0, 0, 0, 0, 0, 0
+        0,
+        0, 0, 0, 0, 0, 0, 0, 0
     }, // Format_RGBA8888_Premultiplied
     {
         0,
@@ -2556,7 +2569,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
         convert_passthrough_inplace<QImage::Format_A2BGR30_Premultiplied>,
         convert_BGR30_to_RGB30_inplace,
         convert_BGR30_to_RGB30_inplace,
-        0, 0
+        0, 0, 0, 0
     }, // Format_BGR30
     {
         0,
@@ -2582,7 +2595,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
         0,
         0,
         convert_BGR30_to_RGB30_inplace,
-        0, 0
+        0, 0, 0, 0
     }, // Format_BGR30A2_Premultiplied
     {
         0,
@@ -2608,7 +2621,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
         convert_BGR30_to_RGB30_inplace,
         0,
         convert_passthrough_inplace<QImage::Format_A2RGB30_Premultiplied>,
-        0, 0
+        0, 0, 0, 0
     }, // Format_RGB30
     {
         0,
@@ -2634,7 +2647,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
         convert_BGR30_to_RGB30_inplace,
         convert_A2RGB30_PM_to_RGB30_inplace,
         0,
-        0, 0
+        0, 0, 0, 0
     }, // Format_RGB30A2_Premultiplied
     {
         0,
@@ -2660,7 +2673,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
         0,
         0,
         0,
-        0, 0
+        0, 0, 0, 0
     }, // Format_Alpha8
     {
         0,
@@ -2686,8 +2699,14 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma
         0,
         0,
         0,
-        0, 0
-    }  // Format_Grayscale8
+        0, 0, 0, 0
+    }, // Format_Grayscale8
+    {
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+    }, // Format_Alpha16
+    {
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+    }  // Format_Grayscale16
 };
 
 void qInitImageConversions()
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index 47e68b1..43a140c 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -151,6 +151,8 @@ inline int qt_depthForFormat(QImage::Format format)
     case QImage::Format_RGB16:
     case QImage::Format_RGB444:
     case QImage::Format_ARGB4444_Premultiplied:
+    case QImage::Format_Alpha16:
+    case QImage::Format_Grayscale16:
         depth = 16;
         break;
     case QImage::Format_RGB666:
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp
index b07e1e2..92aaeb1 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/gui/image/qjpeghandler.cpp
@@ -531,7 +531,7 @@ static bool write_jpeg_image(const QImage &image, QIODevice *device, volatile in
     bool success = false;
     const QVector<QRgb> cmap = image.colorTable();
 
-    if (image.format() == QImage::Format_Invalid || image.format() == QImage::Format_Alpha8)
+    if (image.format() == QImage::Format_Invalid || image.format() == QImage::Format_Alpha8 || image.format() == QImage::Format_Alpha16)
         return false;
 
     struct jpeg_compress_struct cinfo;
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 9c9db1c..ed548b6 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -42,6 +42,7 @@
 
 #include "qbitmap.h"
 #include "qimage.h"
+#include "qrgba64.h"
 #include <QBuffer>
 #include <QImageReader>
 #include <private/qimage_p.h>
@@ -207,6 +208,10 @@ void QRasterPlatformPixmap::fill(const QColor &color)
         pixel = qAlpha(color.rgba());
     } else if (image.format() == QImage::Format_Grayscale8) {
         pixel = qGray(color.rgba());
+    } else if (image.format() == QImage::Format_Alpha16) {
+        pixel = qAlpha16(color.rgba64());
+    } else if (image.format() == QImage::Format_Grayscale16) {
+        pixel = qGray16(color.rgba64());
     } else
     {
         pixel = 0;
diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index 6ed2fe5..9d16ccf 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -1497,16 +1497,18 @@ void QOpenGL2PaintEngineEx::drawImage(const QRectF& dest, const QImage& image, c
         bindOption = 0;
         break;
     case QImage::Format_Alpha8:
+    case QImage::Format_Alpha16:
         if (ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::TextureRGFormats)) {
             d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::AlphaImageSrc);
-            bindOption = QOpenGLTextureCache::UseRedFor8BitBindOption;
+            bindOption = QOpenGLTextureCache::UseRedForAlphaAndLuminanceBindOption;
         } else
             d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::ImageSrc);
         break;
     case QImage::Format_Grayscale8:
+    case QImage::Format_Grayscale16:
         if (ctx->functions()->hasOpenGLFeature(QOpenGLFunctions::TextureRGFormats)) {
             d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::GrayscaleImageSrc);
-            bindOption = QOpenGLTextureCache::UseRedFor8BitBindOption;
+            bindOption = QOpenGLTextureCache::UseRedForAlphaAndLuminanceBindOption;
         } else
             d->shaderManager->setSrcPixelType(QOpenGLEngineShaderManager::ImageSrc);
         break;
diff --git a/src/gui/opengl/qopengltexturecache.cpp b/src/gui/opengl/qopengltexturecache.cpp
index f85a26c..708acb4 100644
--- a/src/gui/opengl/qopengltexturecache.cpp
+++ b/src/gui/opengl/qopengltexturecache.cpp
@@ -277,15 +277,8 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, qint64 key, con
         pixelType = GL_UNSIGNED_BYTE;
         targetFormat = image.format();
         break;
-    case QImage::Format_Indexed8:
-        if (options & UseRedFor8BitBindOption) {
-            externalFormat = internalFormat = GL_RED;
-            pixelType = GL_UNSIGNED_BYTE;
-            targetFormat = image.format();
-        }
-        break;
     case QImage::Format_Alpha8:
-        if (options & UseRedFor8BitBindOption) {
+        if (options & UseRedForAlphaAndLuminanceBindOption) {
             externalFormat = internalFormat = GL_RED;
             pixelType = GL_UNSIGNED_BYTE;
             targetFormat = image.format();
@@ -296,7 +289,7 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, qint64 key, con
         }
         break;
     case QImage::Format_Grayscale8:
-        if (options & UseRedFor8BitBindOption) {
+        if (options & UseRedForAlphaAndLuminanceBindOption) {
             externalFormat = internalFormat = GL_RED;
             pixelType = GL_UNSIGNED_BYTE;
             targetFormat = image.format();
@@ -306,6 +299,28 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, qint64 key, con
             targetFormat = image.format();
         }
         break;
+    case QImage::Format_Alpha16:
+        if (options & UseRedForAlphaAndLuminanceBindOption) {
+            externalFormat = internalFormat = GL_RED;
+            pixelType = GL_UNSIGNED_SHORT;
+            targetFormat = image.format();
+        } else if (context->isOpenGLES() || context->format().profile() != QSurfaceFormat::CoreProfile) {
+            externalFormat = internalFormat = GL_ALPHA;
+            pixelType = GL_UNSIGNED_SHORT;
+            targetFormat = image.format();
+        }
+        break;
+    case QImage::Format_Grayscale16:
+        if (options & UseRedForAlphaAndLuminanceBindOption) {
+            externalFormat = internalFormat = GL_RED;
+            pixelType = GL_UNSIGNED_SHORT;
+            targetFormat = image.format();
+        } else if (context->isOpenGLES() || context->format().profile() != QSurfaceFormat::CoreProfile) {
+            externalFormat = internalFormat = GL_LUMINANCE;
+            pixelType = GL_UNSIGNED_SHORT;
+            targetFormat = image.format();
+        }
+        break;
     default:
         break;
     }
diff --git a/src/gui/opengl/qopengltexturecache_p.h b/src/gui/opengl/qopengltexturecache_p.h
index 7cff139..d7bad3e 100644
--- a/src/gui/opengl/qopengltexturecache_p.h
+++ b/src/gui/opengl/qopengltexturecache_p.h
@@ -78,7 +78,7 @@ public:
     enum BindOption {
         NoBindOption                            = 0x0000,
         PremultipliedAlphaBindOption            = 0x0001,
-        UseRedFor8BitBindOption                 = 0x0002,
+        UseRedForAlphaAndLuminanceBindOption    = 0x0002,
     };
     Q_DECLARE_FLAGS(BindOptions, BindOption)
 
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp
index e174d1f..56feae0 100644
--- a/src/gui/painting/qblendfunctions.cpp
+++ b/src/gui/painting/qblendfunctions.cpp
@@ -767,6 +767,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_Mono
         0,      // Format_Invalid,
@@ -794,6 +796,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_MonoLSB
         0,      // Format_Invalid,
@@ -821,6 +825,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_Indexed8
         0,      // Format_Invalid,
@@ -848,6 +854,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB32
         0,      // Format_Invalid,
@@ -875,6 +883,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB32
         0,      // Format_Invalid,
@@ -902,6 +912,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB32_Premultiplied
         0,      // Format_Invalid,
@@ -929,6 +941,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB16
         0,      // Format_Invalid,
@@ -956,6 +970,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB8565_Premultiplied
         0,      // Format_Invalid,
@@ -983,6 +999,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB666
         0,      // Format_Invalid,
@@ -1010,6 +1028,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB6666_Premultiplied
         0,      // Format_Invalid,
@@ -1037,6 +1057,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB555
         0,      // Format_Invalid,
@@ -1064,6 +1086,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB8555_Premultiplied
         0,      // Format_Invalid,
@@ -1091,6 +1115,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB888
         0,      // Format_Invalid,
@@ -1118,6 +1144,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB444
         0,      // Format_Invalid,
@@ -1145,6 +1173,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB4444_Premultiplied
         0,      // Format_Invalid,
@@ -1172,6 +1202,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGBX8888
         0,      // Format_Invalid,
@@ -1205,6 +1237,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGBA8888
         0,      // Format_Invalid,
@@ -1232,6 +1266,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGBA8888_Premultiplied
         0,      // Format_Invalid,
@@ -1265,6 +1301,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_BGR30
         0,      // Format_Invalid,
@@ -1292,6 +1330,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_A2BGR30_Premultiplied
         0,      // Format_Invalid,
@@ -1319,6 +1359,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB30
         0,      // Format_Invalid,
@@ -1346,6 +1388,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_A2RGB30_Premultiplied
         0,      // Format_Invalid,
@@ -1373,6 +1417,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_Alpha8
         0,      // Format_Invalid,
@@ -1400,6 +1446,8 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_Grayscale8
         0,      // Format_Invalid,
@@ -1427,6 +1475,66 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
+    },
+    {   // Format_Alpha16
+        0,      // Format_Invalid,
+        0,      // Format_Mono,
+        0,      // Format_MonoLSB,
+        0,      // Format_Indexed8,
+        0,      // Format_RGB32,
+        0,      // Format_ARGB32,
+        0,      // Format_ARGB32_Premultiplied,
+        0,      // Format_RGB16,
+        0,      // Format_ARGB8565_Premultiplied,
+        0,      // Format_RGB666,
+        0,      // Format_ARGB6666_Premultiplied,
+        0,      // Format_RGB555,
+        0,      // Format_ARGB8555_Premultiplied,
+        0,      // Format_RGB888,
+        0,      // Format_RGB444,
+        0,      // Format_ARGB4444_Premultiplied,
+        0,      // Format_RGBX8888,
+        0,      // Format_RGBA8888,
+        0,      // Format_RGBA8888_Premultiplied,
+        0,      // Format_BGR30,
+        0,      // Format_A2BGR30_Premultiplied,
+        0,      // Format_RGB30,
+        0,      // Format_A2RGB30_Premultiplied,
+        0,      // Format_Alpha8
+        0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
+    },
+    {   // Format_Grayscale16
+        0,      // Format_Invalid,
+        0,      // Format_Mono,
+        0,      // Format_MonoLSB,
+        0,      // Format_Indexed8,
+        0,      // Format_RGB32,
+        0,      // Format_ARGB32,
+        0,      // Format_ARGB32_Premultiplied,
+        0,      // Format_RGB16,
+        0,      // Format_ARGB8565_Premultiplied,
+        0,      // Format_RGB666,
+        0,      // Format_ARGB6666_Premultiplied,
+        0,      // Format_RGB555,
+        0,      // Format_ARGB8555_Premultiplied,
+        0,      // Format_RGB888,
+        0,      // Format_RGB444,
+        0,      // Format_ARGB4444_Premultiplied,
+        0,      // Format_RGBX8888,
+        0,      // Format_RGBA8888,
+        0,      // Format_RGBA8888_Premultiplied,
+        0,      // Format_BGR30,
+        0,      // Format_A2BGR30_Premultiplied,
+        0,      // Format_RGB30,
+        0,      // Format_A2RGB30_Premultiplied,
+        0,      // Format_Alpha8
+        0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     }
 };
 
@@ -1458,6 +1566,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_Mono
         0,      // Format_Invalid,
@@ -1485,6 +1595,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_MonoLSB
         0,      // Format_Invalid,
@@ -1512,6 +1624,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_Indexed8
         0,      // Format_Invalid,
@@ -1539,6 +1653,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB32
         0,      // Format_Invalid,
@@ -1566,6 +1682,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB32
         0,      // Format_Invalid,
@@ -1593,6 +1711,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB32_Premultiplied
         0,      // Format_Invalid,
@@ -1620,6 +1740,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB16
         0,      // Format_Invalid,
@@ -1647,6 +1769,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB8565_Premultiplied
         0,      // Format_Invalid,
@@ -1674,6 +1798,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB666
         0,      // Format_Invalid,
@@ -1701,6 +1827,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB6666_Premultiplied
         0,      // Format_Invalid,
@@ -1728,6 +1856,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB555
         0,      // Format_Invalid,
@@ -1755,6 +1885,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB8555_Premultiplied
         0,      // Format_Invalid,
@@ -1782,6 +1914,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB888
         0,      // Format_Invalid,
@@ -1809,6 +1943,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB444
         0,      // Format_Invalid,
@@ -1836,6 +1972,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB4444_Premultiplied
         0,      // Format_Invalid,
@@ -1863,6 +2001,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGBX8888
         0,      // Format_Invalid,
@@ -1896,6 +2036,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGBA8888
         0,      // Format_Invalid,
@@ -1923,6 +2065,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGBA8888_Premultiplied
         0,      // Format_Invalid,
@@ -1956,6 +2100,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_BGR30
         0,      // Format_Invalid,
@@ -1981,7 +2127,7 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         qt_blend_a2rgb30pm_on_a2rgb30pm,    // Format_A2RGB30_Premultiplied,
         qt_blend_a2bgr30pm_on_a2rgb30pm,    // Format_RGB30,
         qt_blend_a2bgr30pm_on_a2rgb30pm,    // Format_A2RGB30_Premultiplied,
-        0, 0,
+        0, 0, 0, 0
     },
     {   // Format_A2BGR30_Premultiplied
         0,      // Format_Invalid,
@@ -2007,7 +2153,7 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         qt_blend_a2rgb30pm_on_a2rgb30pm,    // Format_A2BGR30_Premultiplied,
         qt_blend_a2bgr30pm_on_a2rgb30pm,    // Format_RGB30,
         qt_blend_a2bgr30pm_on_a2rgb30pm,    // Format_A2RGB30_Premultiplied,
-        0, 0,
+        0, 0, 0, 0
     },
     {   // Format_RGB30
         0,      // Format_Invalid,
@@ -2033,7 +2179,7 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         qt_blend_a2bgr30pm_on_a2rgb30pm,    // Format_A2BGR30_Premultiplied,
         qt_blend_rgb30_on_rgb30,            // Format_RGB30,
         qt_blend_a2rgb30pm_on_a2rgb30pm,    // Format_A2RGB30_Premultiplied,
-        0, 0,
+        0, 0, 0, 0
     },
     {   // Format_A2RGB30_Premultiplied
         0,      // Format_Invalid,
@@ -2059,7 +2205,7 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         qt_blend_a2bgr30pm_on_a2rgb30pm,      // Format_A2BGR30_Premultiplied,
         qt_blend_rgb30_on_rgb30,              // Format_RGB30,
         qt_blend_a2rgb30pm_on_a2rgb30pm,      // Format_A2RGB30_Premultiplied,
-        0, 0,
+        0, 0, 0, 0
     },
     {   // Format_Alpha8
         0,      // Format_Invalid,
@@ -2087,6 +2233,8 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_Grayscale8
         0,      // Format_Invalid,
@@ -2114,6 +2262,66 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] =
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
+    },
+    {   // Format_Alpha16
+        0,      // Format_Invalid,
+        0,      // Format_Mono,
+        0,      // Format_MonoLSB,
+        0,      // Format_Indexed8,
+        0,      // Format_RGB32,
+        0,      // Format_ARGB32,
+        0,      // Format_ARGB32_Premultiplied,
+        0,      // Format_RGB16,
+        0,      // Format_ARGB8565_Premultiplied,
+        0,      // Format_RGB666,
+        0,      // Format_ARGB6666_Premultiplied,
+        0,      // Format_RGB555,
+        0,      // Format_ARGB8555_Premultiplied,
+        0,      // Format_RGB888,
+        0,      // Format_RGB444,
+        0,      // Format_ARGB4444_Premultiplied,
+        0,      // Format_RGBX8888,
+        0,      // Format_RGBA8888,
+        0,      // Format_RGBA8888_Premultiplied,
+        0,      // Format_BGR30,
+        0,      // Format_A2BGR30_Premultiplied,
+        0,      // Format_RGB30,
+        0,      // Format_A2RGB30_Premultiplied,
+        0,      // Format_Alpha8
+        0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
+    },
+    {   // Format_Grayscale16
+        0,      // Format_Invalid,
+        0,      // Format_Mono,
+        0,      // Format_MonoLSB,
+        0,      // Format_Indexed8,
+        0,      // Format_RGB32,
+        0,      // Format_ARGB32,
+        0,      // Format_ARGB32_Premultiplied,
+        0,      // Format_RGB16,
+        0,      // Format_ARGB8565_Premultiplied,
+        0,      // Format_RGB666,
+        0,      // Format_ARGB6666_Premultiplied,
+        0,      // Format_RGB555,
+        0,      // Format_ARGB8555_Premultiplied,
+        0,      // Format_RGB888,
+        0,      // Format_RGB444,
+        0,      // Format_ARGB4444_Premultiplied,
+        0,      // Format_RGBX8888,
+        0,      // Format_RGBA8888,
+        0,      // Format_RGBA8888_Premultiplied,
+        0,      // Format_BGR30,
+        0,      // Format_A2BGR30_Premultiplied,
+        0,      // Format_RGB30,
+        0,      // Format_A2RGB30_Premultiplied,
+        0,      // Format_Alpha8
+        0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     }
 };
 
@@ -2144,6 +2352,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_Mono
         0,      // Format_Invalid,
@@ -2171,6 +2381,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_MonoLSB
         0,      // Format_Invalid,
@@ -2198,6 +2410,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_Indexed8
         0,      // Format_Invalid,
@@ -2225,6 +2439,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB32
         0,      // Format_Invalid,
@@ -2252,6 +2468,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB32
         0,      // Format_Invalid,
@@ -2279,6 +2497,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB32_Premultiplied
         0,      // Format_Invalid,
@@ -2306,6 +2526,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB16
         0,      // Format_Invalid,
@@ -2333,6 +2555,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB8565_Premultiplied
         0,      // Format_Invalid,
@@ -2360,6 +2584,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB666
         0,      // Format_Invalid,
@@ -2387,6 +2613,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB6666_Premultiplied
         0,      // Format_Invalid,
@@ -2414,6 +2642,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB555
         0,      // Format_Invalid,
@@ -2441,6 +2671,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB8555_Premultiplied
         0,      // Format_Invalid,
@@ -2468,6 +2700,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB888
         0,      // Format_Invalid,
@@ -2495,6 +2729,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB444
         0,      // Format_Invalid,
@@ -2522,6 +2758,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_ARGB4444_Premultiplied
         0,      // Format_Invalid,
@@ -2549,6 +2787,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGBX8888
         0,      // Format_Invalid,
@@ -2582,6 +2822,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGBA8888
         0,      // Format_Invalid,
@@ -2609,6 +2851,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGBA8888_Premultiplied
         0,      // Format_Invalid,
@@ -2642,6 +2886,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_BGR30
         0,      // Format_Invalid,
@@ -2669,6 +2915,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_A2BGR30_Premultiplied
         0,      // Format_Invalid,
@@ -2696,6 +2944,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_RGB30
         0,      // Format_Invalid,
@@ -2723,6 +2973,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_A2RGB30_Premultiplied
         0,      // Format_Invalid,
@@ -2750,6 +3002,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_Alpha8
         0,      // Format_Invalid,
@@ -2777,6 +3031,8 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
     {   // Format_Grayscale8
         0,      // Format_Invalid,
@@ -2804,6 +3060,66 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo
         0,      // Format_A2RGB30_Premultiplied,
         0,      // Format_Alpha8
         0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
+    },
+    {   // Format_Alpha16
+        0,      // Format_Invalid,
+        0,      // Format_Mono,
+        0,      // Format_MonoLSB,
+        0,      // Format_Indexed8,
+        0,      // Format_RGB32,
+        0,      // Format_ARGB32,
+        0,      // Format_ARGB32_Premultiplied,
+        0,      // Format_RGB16,
+        0,      // Format_ARGB8565_Premultiplied,
+        0,      // Format_RGB666,
+        0,      // Format_ARGB6666_Premultiplied,
+        0,      // Format_RGB555,
+        0,      // Format_ARGB8555_Premultiplied,
+        0,      // Format_RGB888,
+        0,      // Format_RGB444,
+        0,      // Format_ARGB4444_Premultiplied,
+        0,      // Format_RGBX8888,
+        0,      // Format_RGBA8888,
+        0,      // Format_RGBA8888_Premultiplied,
+        0,      // Format_BGR30,
+        0,      // Format_A2BGR30_Premultiplied,
+        0,      // Format_RGB30,
+        0,      // Format_A2RGB30_Premultiplied,
+        0,      // Format_Alpha8
+        0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
+    },
+    {   // Format_Grayscale16
+        0,      // Format_Invalid,
+        0,      // Format_Mono,
+        0,      // Format_MonoLSB,
+        0,      // Format_Indexed8,
+        0,      // Format_RGB32,
+        0,      // Format_ARGB32,
+        0,      // Format_ARGB32_Premultiplied,
+        0,      // Format_RGB16,
+        0,      // Format_ARGB8565_Premultiplied,
+        0,      // Format_RGB666,
+        0,      // Format_ARGB6666_Premultiplied,
+        0,      // Format_RGB555,
+        0,      // Format_ARGB8555_Premultiplied,
+        0,      // Format_RGB888,
+        0,      // Format_RGB444,
+        0,      // Format_ARGB4444_Premultiplied,
+        0,      // Format_RGBX8888,
+        0,      // Format_RGBA8888,
+        0,      // Format_RGBA8888_Premultiplied,
+        0,      // Format_BGR30,
+        0,      // Format_A2BGR30_Premultiplied,
+        0,      // Format_RGB30,
+        0,      // Format_A2RGB30_Premultiplied,
+        0,      // Format_Alpha8
+        0,      // Format_Grayscale8
+        0,      // Format_Alpha16
+        0,      // Format_Grayscale16
     },
 };
 
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 582f115..7a362c6 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -588,6 +588,27 @@ static const uint *QT_FASTCALL convertGrayscale8ToRGB32(uint *buffer, const uint
     return buffer;
 }
 
+static const uint *QT_FASTCALL convertAlpha16ToRGB32(uint *buffer, const uint *src, int count,
+                                                     const QPixelLayout *, const QRgb *)
+{
+    for (int i = 0; i < count; ++i) {
+        buffer[i] = qRgba(0, 0, 0, src[i] >> 8);
+    }
+    return buffer;
+}
+
+static const uint *QT_FASTCALL convertGrayscale16ToRGB32(uint *buffer, const uint *src, int count,
+                                                        const QPixelLayout *, const QRgb *)
+{
+    for (int i = 0; i < count; ++i) {
+        int green = (src[i] + 128) >> 8;
+        int red = std::min(std::max(green + (int)((src[i] >> 6) & 3) - 2, 255), 0);
+        int blue = std::min(std::max(green + (int)((src[i] >> 4) & 7) - 4, 255), 0);
+        buffer[i] = qRgb(red, green, blue);
+    }
+    return buffer;
+}
+
 static const uint *QT_FASTCALL convertARGB32FromARGB32PM(uint *buffer, const uint *src, int count,
                                                          const QPixelLayout *, const QRgb *)
 {
@@ -722,6 +743,30 @@ static const uint *QT_FASTCALL convertGrayscale8FromARGB32PM(uint *buffer, const
     return buffer;
 }
 
+static const uint *QT_FASTCALL convertGrayscale16FromRGB32(uint *buffer, const uint *src, int count,
+                                                           const QPixelLayout *, const QRgb *)
+{
+    for (int i = 0; i < count; ++i)
+        buffer[i] = qGray16(src[i]);
+    return buffer;
+}
+
+static const uint *QT_FASTCALL convertGrayscale16FromARGB32PM(uint *buffer, const uint *src, int count,
+                                                              const QPixelLayout *, const QRgb *)
+{
+    for (int i = 0; i < count; ++i)
+        buffer[i] = qGray16(qUnpremultiply(src[i]));
+    return buffer;
+}
+
+static const uint *QT_FASTCALL convertAlpha16FromARGB32PM(uint *buffer, const uint *src, int count,
+                                                          const QPixelLayout *, const QRgb *)
+{
+    for (int i = 0; i < count; ++i)
+        buffer[i] = qAlpha16(src[i]);
+    return buffer;
+}
+
 template <QPixelLayout::BPP bpp> static
 uint QT_FASTCALL fetchPixel(const uchar *src, int index);
 
@@ -876,7 +921,9 @@ QPixelLayout qPixelLayouts[QImage::NImageFormats] = {
     { 10,  0, 10,  10, 10, 20, 0, 30, false, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderRGB>, convertRGB30FromARGB32PM<PixelOrderRGB>, convertRGB30FromRGB32<PixelOrderRGB> }, // Format_RGB30
     { 10,  0, 10,  10, 10, 20, 2, 30,  true, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderRGB>, convertA2RGB30PMFromARGB32PM<PixelOrderRGB>, convertRGB30FromRGB32<PixelOrderRGB> },  // Format_A2RGB30_Premultiplied
     { 0, 0,  0, 0,  0, 0,  8, 0, false, QPixelLayout::BPP8, convertAlpha8ToRGB32, convertAlpha8FromARGB32PM, 0 }, // Format_Alpha8
-    { 0, 0,  0, 0,  0, 0,  0, 0, false, QPixelLayout::BPP8, convertGrayscale8ToRGB32, convertGrayscale8FromARGB32PM, convertGrayscale8FromRGB32 } // Format_Grayscale8
+    { 0, 0,  0, 0,  0, 0,  0, 0, false, QPixelLayout::BPP8, convertGrayscale8ToRGB32, convertGrayscale8FromARGB32PM, convertGrayscale8FromRGB32 }, // Format_Grayscale8
+    { 0, 0,  0, 0,  0, 0, 16, 0, false, QPixelLayout::BPP16, convertAlpha16ToRGB32, convertAlpha16FromARGB32PM, convertGrayscale16FromRGB32 }, // Format_Alpha16
+    { 0, 0,  0, 0,  0, 0,  0, 0, false, QPixelLayout::BPP16, convertGrayscale16ToRGB32, convertGrayscale16FromARGB32PM, convertGrayscale16FromRGB32 } // Format_Grayscale16
 };
 
 FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount] = {
@@ -1019,6 +1066,39 @@ static DestFetchProc destFetchProc[QImage::NImageFormats] =
     destFetch,          // Format_A2RGB30_Premultiplied
     destFetch,          // Format_Alpha8
     destFetch,          // Format_Grayscale8
+    destFetch,          // Format_Alpha16
+    destFetch,          // Format_Grayscale16
+};
+
+static DestFetchProc64 destFetchProc64[QImage::NImageFormats] =
+{
+    0,                  // Format_Invalid
+    destFetch64,        // Format_Mono,
+    destFetch64,        // Format_MonoLSB
+    0,                  // Format_Indexed8
+    destFetch64,        // Format_RGB32
+    destFetch64ARGB32,  // Format_ARGB32,
+    destFetch64,        // Format_ARGB32_Premultiplied
+    destFetch64,        // Format_RGB16
+    destFetch64,        // Format_ARGB8565_Premultiplied
+    destFetch64,        // Format_RGB666
+    destFetch64,        // Format_ARGB6666_Premultiplied
+    destFetch64,        // Format_RGB555
+    destFetch64,        // Format_ARGB8555_Premultiplied
+    destFetch64,        // Format_RGB888
+    destFetch64,        // Format_RGB444
+    destFetch64,        // Format_ARGB4444_Premultiplied
+    destFetch64,        // Format_RGBX8888
+    destFetch64,        // Format_RGBA8888
+    destFetch64,        // Format_RGBA8888_Premultiplied
+    destFetch64RGB30<PixelOrderBGR>,        // Format_BGR30
+    destFetch64RGB30<PixelOrderBGR>,        // Format_A2BGR30_Premultiplied
+    destFetch64RGB30<PixelOrderRGB>,        // Format_RGB30
+    destFetch64RGB30<PixelOrderRGB>,        // Format_A2RGB30_Premultiplied
+    destFetch64,        // Format_Alpha8
+    destFetch64,        // Format_Grayscale8
+    destFetch64,        // Format_Alpha16
+    destFetch64,        // Format_Grayscale16
 };
 
 static DestFetchProc64 destFetchProc64[QImage::NImageFormats] =
@@ -1238,6 +1318,39 @@ static DestStoreProc destStoreProc[QImage::NImageFormats] =
     destStore,          // Format_A2RGB30_Premultiplied
     destStore,          // Format_Alpha8
     destStore,          // Format_Grayscale8
+    destStore,          // Format_Alpha16
+    destStore,          // Format_Grayscale16
+};
+
+static DestStoreProc64 destStoreProc64[QImage::NImageFormats] =
+{
+    0,                  // Format_Invalid
+    destStore64,        // Format_Mono,
+    destStore64,        // Format_MonoLSB
+    0,                  // Format_Indexed8
+    destStore64,        // Format_RGB32
+    destStore64ARGB32,  // Format_ARGB32,
+    destStore64,        // Format_ARGB32_Premultiplied
+    destStore64,        // Format_RGB16
+    destStore64,        // Format_ARGB8565_Premultiplied
+    destStore64,        // Format_RGB666
+    destStore64,        // Format_ARGB6666_Premultiplied
+    destStore64,        // Format_RGB555
+    destStore64,        // Format_ARGB8555_Premultiplied
+    destStore64,        // Format_RGB888
+    destStore64,        // Format_RGB444
+    destStore64,        // Format_ARGB4444_Premultiplied
+    destStore64,        // Format_RGBX8888
+    destStore64,        // Format_RGBA8888
+    destStore64,        // Format_RGBA8888_Premultiplied
+    destStore64RGB30<PixelOrderBGR>,        // Format_BGR30
+    destStore64RGB30<PixelOrderBGR>,        // Format_A2BGR30_Premultiplied
+    destStore64RGB30<PixelOrderRGB>,        // Format_RGB30
+    destStore64RGB30<PixelOrderRGB>,        // Format_A2RGB30_Premultiplied
+    destStore64,        // Format_Alpha8
+    destStore64,        // Format_Grayscale8
+    destStore64,        // Format_Alpha16
+    destStore64,        // Format_Grayscale16
 };
 
 static DestStoreProc64 destStoreProc64[QImage::NImageFormats] =
@@ -2524,6 +2637,8 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
         fetchUntransformed,         // Format_A2RGB30_Premultiplied
         fetchUntransformed,         // Alpha8
         fetchUntransformed,         // Grayscale8
+        fetchUntransformed,         // Alpha16
+        fetchUntransformed,         // Grayscale16
     },
     // Tiled
     {
@@ -2552,6 +2667,8 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
         fetchUntransformed,         // A2RGB30_Premultiplied
         fetchUntransformed,         // Alpha8
         fetchUntransformed,         // Grayscale8
+        fetchUntransformed,         // Alpha16
+        fetchUntransformed,         // Grayscale16
     },
     // Transformed
     {
@@ -2578,8 +2695,10 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
         fetchTransformed<BlendTransformed>,         // A2BGR30_Premultiplied
         fetchTransformed<BlendTransformed>,         // RGB30
         fetchTransformed<BlendTransformed>,         // A2RGB30_Premultiplied
-        fetchTransformed<BlendTransformed>,         // Alpah8
+        fetchTransformed<BlendTransformed>,         // Alpha8
         fetchTransformed<BlendTransformed>,         // Grayscale8
+        fetchTransformed<BlendTransformed>,         // Alpha16
+        fetchTransformed<BlendTransformed>,         // Grayscale16
     },
     {
         0, // TransformedTiled
@@ -2607,6 +2726,8 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
         fetchTransformed<BlendTransformedTiled>,            // A2RGB30_Premultiplied
         fetchTransformed<BlendTransformedTiled>,            // Alpha8
         fetchTransformed<BlendTransformedTiled>,            // Grayscale8
+        fetchTransformed<BlendTransformedTiled>,            // Alpha16
+        fetchTransformed<BlendTransformedTiled>,            // Grayscale16
     },
     {
         0, // Bilinear
@@ -2634,6 +2755,8 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
         fetchTransformedBilinear<BlendTransformedBilinear>,         // A2RGB30_Premultiplied
         fetchTransformedBilinear<BlendTransformedBilinear>,         // Alpha8
         fetchTransformedBilinear<BlendTransformedBilinear>,         // Grayscale8
+        fetchTransformedBilinear<BlendTransformedBilinear>,         // Alpha16
+        fetchTransformedBilinear<BlendTransformedBilinear>,         // Grayscale16
     },
     {
         0, // BilinearTiled
@@ -2661,6 +2784,8 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
         fetchTransformedBilinear<BlendTransformedBilinearTiled>,            // A2RGB30_Premultiplied
         fetchTransformedBilinear<BlendTransformedBilinearTiled>,            // Alpha8
         fetchTransformedBilinear<BlendTransformedBilinearTiled>,            // Grayscale8
+        fetchTransformedBilinear<BlendTransformedBilinearTiled>,            // Alpha16
+        fetchTransformedBilinear<BlendTransformedBilinearTiled>,            // Grayscale16
     },
 };
 
@@ -6457,6 +6582,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
         blend_untransformed_generic_rgb64,
         blend_untransformed_generic,
         blend_untransformed_generic,
+        blend_untransformed_generic_rgb64,
+        blend_untransformed_generic_rgb64,
     },
     // Tiled
     {
@@ -6477,14 +6604,16 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
         blend_tiled_generic,
         blend_tiled_generic,
         blend_tiled_generic,
-        blend_tiled_generic,
-        blend_tiled_generic,
         blend_tiled_generic_rgb64,
         blend_tiled_generic_rgb64,
         blend_tiled_generic_rgb64,
         blend_tiled_generic_rgb64,
         blend_tiled_generic,
         blend_tiled_generic,
+        blend_tiled_generic,
+        blend_tiled_generic,
+        blend_tiled_generic_rgb64,
+        blend_tiled_generic_rgb64,
     },
     // Transformed
     {
@@ -6503,16 +6632,18 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
         blend_src_generic,
         blend_src_generic,
         blend_src_generic,
-        blend_src_generic,
-        blend_src_generic,
-        blend_src_generic,
-        blend_src_generic,
         blend_src_generic_rgb64,
         blend_src_generic_rgb64,
         blend_src_generic_rgb64,
         blend_src_generic_rgb64,
         blend_src_generic,
         blend_src_generic,
+        blend_src_generic,
+        blend_src_generic,
+        blend_src_generic,
+        blend_src_generic,
+        blend_src_generic_rgb64,
+        blend_src_generic_rgb64,
     },
      // TransformedTiled
     {
@@ -6540,6 +6671,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
         blend_src_generic_rgb64,
         blend_src_generic,
         blend_src_generic,
+        blend_src_generic_rgb64,
+        blend_src_generic_rgb64,
     },
     // Bilinear
     {
@@ -6554,6 +6687,12 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
         blend_src_generic,
         blend_src_generic,
         blend_src_generic,
+        blend_src_generic_rgb64,
+        blend_src_generic_rgb64,
+        blend_src_generic_rgb64,
+        blend_src_generic_rgb64,
+        blend_src_generic,
+        blend_src_generic,
         blend_src_generic,
         blend_src_generic,
         blend_src_generic,
@@ -6564,10 +6703,6 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
         blend_src_generic,
         blend_src_generic_rgb64,
         blend_src_generic_rgb64,
-        blend_src_generic_rgb64,
-        blend_src_generic_rgb64,
-        blend_src_generic,
-        blend_src_generic,
     },
     // BilinearTiled
     {
@@ -6596,6 +6731,8 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
         blend_src_generic_rgb64, // A2RGB30_Premultiplied
         blend_src_generic, // Alpha8
         blend_src_generic, // Grayscale8
+        blend_src_generic_rgb64, // Alpha16
+        blend_src_generic_rgb64, // Grayscale16
     }
 };
 
@@ -7350,6 +7487,18 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
         0, 0, 0,
         qt_rectfill_gray
     },
+    // Format_Alpha16
+    {
+        blend_color_generic_rgb64,
+        blend_src_generic_rgb64,
+        0, 0, 0, 0
+    },
+    // Format_Grayscale16
+    {
+        blend_color_generic_rgb64,
+        blend_src_generic_rgb64,
+        0, 0, 0, 0
+    },
 };
 
 #if defined(Q_CC_MSVC) && !defined(_MIPS_)
diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp
index 442eda1..f4ca98f 100644
--- a/src/gui/painting/qmemrotate.cpp
+++ b/src/gui/painting/qmemrotate.cpp
@@ -546,6 +546,8 @@ MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3] =
     { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 },      // Format_A2RGB30_Premultiplied,
     { qt_memrotate90_8, qt_memrotate180_8, qt_memrotate270_8 },         // Format_Alpha8,
     { qt_memrotate90_8, qt_memrotate180_8, qt_memrotate270_8 },         // Format_Grayscale8,
+    { qt_memrotate90_16, qt_memrotate180_16, qt_memrotate270_16 },      // Format_Alpha16,
+    { qt_memrotate90_16, qt_memrotate180_16, qt_memrotate270_16 },      // Format_Grayscale16,
 };
 
 QT_END_NAMESPACE
diff --git a/src/gui/painting/qrgb.h b/src/gui/painting/qrgb.h
index 7186081..d348ec2 100644
--- a/src/gui/painting/qrgb.h
+++ b/src/gui/painting/qrgb.h
@@ -57,16 +57,25 @@ inline Q_DECL_CONSTEXPR int qBlue(QRgb rgb)                // get blue part of R
 inline Q_DECL_CONSTEXPR int qAlpha(QRgb rgb)                // get alpha part of RGBA
 { return rgb >> 24; }
 
+inline Q_DECL_CONSTEXPR int qAlpha16(QRgb rgb)              // get 16bit alpha component
+{ return qAlpha(rgb) * 257; }
+
 inline Q_DECL_CONSTEXPR QRgb qRgb(int r, int g, int b)// set RGB value
 { return (0xffu << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }
 
 inline Q_DECL_CONSTEXPR QRgb qRgba(int r, int g, int b, int a)// set RGBA value
 { return ((a & 0xff) << 24) | ((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff); }
 
-inline Q_DECL_CONSTEXPR int qGray(int r, int g, int b)// convert R,G,B to gray 0..255
+inline Q_DECL_CONSTEXPR int qGray(int r, int g, int b)      // convert R,G,B to gray 0..255
 { return (r*11+g*16+b*5)/32; }
 
-inline Q_DECL_CONSTEXPR int qGray(QRgb rgb)                // convert RGB to gray 0..255
+inline Q_DECL_CONSTEXPR int qGray16(int r, int g, int b)    // convert R,G,B to gray 0..65536
+{ return (r*110+g*366+b*38)/2; }
+
+inline Q_DECL_CONSTEXPR int qGray(QRgb rgb)                 // convert RGB to gray 0..255
+{ return qGray(qRed(rgb), qGreen(rgb), qBlue(rgb)); }
+
+inline Q_DECL_CONSTEXPR int qGray16(QRgb rgb)               // convert RGB to gray 0..65536
 { return qGray(qRed(rgb), qGreen(rgb), qBlue(rgb)); }
 
 inline Q_DECL_CONSTEXPR bool qIsGray(QRgb rgb)
diff --git a/src/gui/painting/qrgba64.h b/src/gui/painting/qrgba64.h
index 4f158aa..76fd5ec 100644
--- a/src/gui/painting/qrgba64.h
+++ b/src/gui/painting/qrgba64.h
@@ -176,6 +176,21 @@ inline Q_DECL_CONSTEXPR uint qBlue(QRgba64 rgb)
 inline Q_DECL_CONSTEXPR uint qAlpha(QRgba64 rgb)
 { return rgb.alpha8(); }
 
+inline Q_DECL_CONSTEXPR uint qRed16(QRgba64 rgb)
+{ return rgb.red; }
+
+inline Q_DECL_CONSTEXPR uint qGreen16(QRgba64 rgb)
+{ return rgb.green; }
+
+inline Q_DECL_CONSTEXPR uint qBlue16(QRgba64 rgb)
+{ return rgb.blue; }
+
+inline Q_DECL_CONSTEXPR uint qAlpha16(QRgba64 rgb)
+{ return rgb.alpha; }
+
+inline Q_DECL_CONSTEXPR uint qGray16(QRgba64 rgb)
+{ return (rgb.red*11+rgb.green*16+rgb.blue*5)/32; }
+
 QT_END_NAMESPACE
 
 #endif // QRGBA64_H
diff --git a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
index fbbf9b3..f949ed0 100644
--- a/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
+++ b/tests/auto/gui/painting/qpainter/tst_qpainter.cpp
@@ -3491,8 +3491,8 @@ void tst_QPainter::drawImage_data()
 
     for (int srcFormat = QImage::Format_Mono; srcFormat < QImage::NImageFormats; ++srcFormat) {
         for (int dstFormat = QImage::Format_Mono; dstFormat < QImage::NImageFormats; ++dstFormat) {
-            // Indexed8 can't be painted to, and Alpha8 can't hold a color.
-            if (dstFormat == QImage::Format_Indexed8 || dstFormat == QImage::Format_Alpha8)
+            // Indexed8 can't be painted to, and Alpha8/Alpha16 can't hold a color.
+            if (dstFormat == QImage::Format_Indexed8 || dstFormat == QImage::Format_Alpha8 || dstFormat == QImage::Format_Alpha16)
                 continue;
             for (int odd_x = 0; odd_x <= 1; ++odd_x) {
                 for (int odd_width = 0; odd_width <= 1; ++odd_width) {
