Index: /trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.cpp
===================================================================
--- /trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.cpp	(revision 52957)
+++ /trunk/src/VBox/Frontends/VirtualBox/src/VBoxSnapshotDetailsDlg.cpp	(revision 52958)
@@ -74,5 +74,5 @@
     /* Get thumbnail if present */
     ULONG width = 0, height = 0;
-    QVector <BYTE> thumbData = machine.ReadSavedThumbnailToArray (0, true, width, height);
+    QVector <BYTE> thumbData = machine.ReadSavedThumbnailToArray (0, KBitmapFormat_BGR0, width, height);
     mThumbnail = thumbData.size() != 0 ? QPixmap::fromImage (QImage (thumbData.data(), width, height, QImage::Format_RGB32).copy()) : QPixmap();
     QVector <BYTE> screenData = machine.ReadSavedScreenshotPNGToArray (0, width, height);
Index: /trunk/src/VBox/Main/idl/VirtualBox.xidl
===================================================================
--- /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 52957)
+++ /trunk/src/VBox/Main/idl/VirtualBox.xidl	(revision 52958)
@@ -4249,5 +4249,5 @@
   <interface
     name="IMachine" extends="$unknown"
-    uuid="96ae59d6-fecd-4a32-b051-23643eb4cd56"
+    uuid="2280b3f8-0c33-4641-8bd5-ccecd1071b49"
     wsmap="managed"
     wrap-hint-server-addinterfaces="IInternalMachineControl"
@@ -7128,5 +7128,5 @@
     <method name="readSavedThumbnailToArray">
       <desc>
-        Thumbnail is retrieved to an array of bytes in uncompressed 32-bit BGRA or RGBA format.
+        Thumbnail is retrieved to an array of bytes in the requested format.
       </desc>
       <param name="screenId" type="unsigned long" dir="in">
@@ -7135,8 +7135,7 @@
         </desc>
       </param>
-      <param name="BGR" type="boolean" dir="in">
-        <desc>
-          How to order bytes in the pixel. A pixel consists of 4 bytes. If this parameter is true, then
-          bytes order is: B, G, R, 0xFF. If this parameter is false, then bytes order is: R, G, B, 0xFF.
+      <param name="bitmapFormat" type="BitmapFormat" dir="in">
+        <desc>
+          The requested format.
         </desc>
       </param>
@@ -7154,30 +7153,4 @@
         <desc>
           Array with resulting bitmap data.
-        </desc>
-      </param>
-    </method>
-
-    <method name="readSavedThumbnailPNGToArray">
-      <desc>
-        Thumbnail in PNG format is retrieved to an array of bytes.
-      </desc>
-      <param name="screenId" type="unsigned long" dir="in">
-        <desc>
-          Saved guest screen to read from.
-        </desc>
-      </param>
-      <param name="width" type="unsigned long" dir="out">
-        <desc>
-          Image width.
-        </desc>
-      </param>
-      <param name="height" type="unsigned long" dir="out">
-        <desc>
-          Image height.
-        </desc>
-      </param>
-      <param name="data" type="octet" dir="return" safearray="yes">
-        <desc>
-          Array with resulting PNG data.
         </desc>
       </param>
Index: /trunk/src/VBox/Main/include/MachineImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/MachineImpl.h	(revision 52957)
+++ /trunk/src/VBox/Main/include/MachineImpl.h	(revision 52958)
@@ -1103,12 +1103,8 @@
                                     ULONG *aHeight);
     HRESULT readSavedThumbnailToArray(ULONG aScreenId,
-                                      BOOL aBGR,
+                                      BitmapFormat_T aBitmapFormat,
                                       ULONG *aWidth,
                                       ULONG *aHeight,
                                       std::vector<BYTE> &aData);
-    HRESULT readSavedThumbnailPNGToArray(ULONG aScreenId,
-                                         ULONG *aWidth,
-                                         ULONG *aHeight,
-                                         std::vector<BYTE> &aData);
     HRESULT querySavedScreenshotPNGSize(ULONG aScreenId,
                                         ULONG *aSize,
Index: /trunk/src/VBox/Main/src-server/MachineImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 52957)
+++ /trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 52958)
@@ -6306,9 +6306,16 @@
 }
 
-
-HRESULT Machine::readSavedThumbnailToArray(ULONG aScreenId, BOOL aBGR, ULONG *aWidth, ULONG *aHeight, std::vector<BYTE> &aData)
+HRESULT Machine::readSavedThumbnailToArray(ULONG aScreenId, BitmapFormat_T aBitmapFormat,
+                                           ULONG *aWidth, ULONG *aHeight, std::vector<BYTE> &aData)
 {
     if (aScreenId != 0)
         return E_NOTIMPL;
+
+    if (   aBitmapFormat != BitmapFormat_BGR0
+        && aBitmapFormat != BitmapFormat_BGRA
+        && aBitmapFormat != BitmapFormat_RGBA
+        && aBitmapFormat != BitmapFormat_PNG)
+        return setError(E_NOTIMPL,
+                        tr("Unsupported saved thumbnail format 0x%08X"), aBitmapFormat);
 
     AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
@@ -6323,32 +6330,66 @@
     if (RT_FAILURE(vrc))
         return setError(VBOX_E_IPRT_ERROR,
-                        tr("Saved screenshot data is not available (%Rrc)"),
+                        tr("Saved thumbnail data is not available (%Rrc)"),
                         vrc);
+
+    HRESULT hr = S_OK;
 
     *aWidth = u32Width;
     *aHeight = u32Height;
 
-    aData.resize(cbData);
-    /* Convert pixels to format expected by the API caller. */
-    if (aBGR)
-    {
-        /* [0] B, [1] G, [2] R, [3] A. */
-        for (unsigned i = 0; i < cbData; i += 4)
-        {
-            aData[i]     = pu8Data[i];
-            aData[i + 1] = pu8Data[i + 1];
-            aData[i + 2] = pu8Data[i + 2];
-            aData[i + 3] = 0xff;
-        }
-    }
-    else
-    {
-        /* [0] R, [1] G, [2] B, [3] A. */
-        for (unsigned i = 0; i < cbData; i += 4)
-        {
-            aData[i]     = pu8Data[i + 2];
-            aData[i + 1] = pu8Data[i + 1];
-            aData[i + 2] = pu8Data[i];
-            aData[i + 3] = 0xff;
+    if (cbData > 0)
+    {
+        /* Convert pixels to the format expected by the API caller. */
+        if (aBitmapFormat == BitmapFormat_BGR0)
+        {
+            /* [0] B, [1] G, [2] R, [3] 0. */
+            aData.resize(cbData);
+            memcpy(&aData.front(), pu8Data, cbData);
+        }
+        else if (aBitmapFormat == BitmapFormat_BGRA)
+        {
+            /* [0] B, [1] G, [2] R, [3] A. */
+            aData.resize(cbData);
+            for (uint32_t i = 0; i < cbData; i += 4)
+            {
+                aData[i]     = pu8Data[i];
+                aData[i + 1] = pu8Data[i + 1];
+                aData[i + 2] = pu8Data[i + 2];
+                aData[i + 3] = 0xff;
+            }
+        }
+        else if (aBitmapFormat == BitmapFormat_RGBA)
+        {
+            /* [0] R, [1] G, [2] B, [3] A. */
+            aData.resize(cbData);
+            for (uint32_t i = 0; i < cbData; i += 4)
+            {
+                aData[i]     = pu8Data[i + 2];
+                aData[i + 1] = pu8Data[i + 1];
+                aData[i + 2] = pu8Data[i];
+                aData[i + 3] = 0xff;
+            }
+        }
+        else if (aBitmapFormat == BitmapFormat_PNG)
+        {
+            uint8_t *pu8PNG = NULL;
+            uint32_t cbPNG = 0;
+            uint32_t cxPNG = 0;
+            uint32_t cyPNG = 0;
+
+            vrc = DisplayMakePNG(pu8Data, u32Width, u32Height, &pu8PNG, &cbPNG, &cxPNG, &cyPNG, 0);
+
+            if (RT_SUCCESS(vrc))
+            {
+                aData.resize(cbPNG);
+                if (cbPNG)
+                    memcpy(&aData.front(), pu8PNG, cbPNG);
+            }
+            else
+                hr = setError(VBOX_E_IPRT_ERROR,
+                              tr("Could not convert saved thumbnail to PNG (%Rrc)"),
+                              vrc);
+
+            RTMemFree(pu8PNG);
         }
     }
@@ -6356,57 +6397,5 @@
     freeSavedDisplayScreenshot(pu8Data);
 
-    return S_OK;
-}
-
-HRESULT Machine::readSavedThumbnailPNGToArray(ULONG aScreenId, ULONG *aWidth, ULONG *aHeight, std::vector<BYTE> &aData)
-{
-    if (aScreenId != 0)
-        return E_NOTIMPL;
-
-    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
-
-    uint8_t *pu8Data = NULL;
-    uint32_t cbData = 0;
-    uint32_t u32Width = 0;
-    uint32_t u32Height = 0;
-
-    int vrc = readSavedDisplayScreenshot(mSSData->strStateFilePath, 0 /* u32Type */, &pu8Data, &cbData, &u32Width, &u32Height);
-
-    if (RT_FAILURE(vrc))
-        return setError(VBOX_E_IPRT_ERROR,
-                        tr("Saved screenshot data is not available (%Rrc)"),
-                        vrc);
-
-    *aWidth = u32Width;
-    *aHeight = u32Height;
-
-    HRESULT rc = S_OK;
-    uint8_t *pu8PNG = NULL;
-    uint32_t cbPNG = 0;
-    uint32_t cxPNG = 0;
-    uint32_t cyPNG = 0;
-
-    vrc = DisplayMakePNG(pu8Data, u32Width, u32Height, &pu8PNG, &cbPNG, &cxPNG, &cyPNG, 0);
-
-    if (RT_SUCCESS(vrc))
-    {
-        aData.resize(cbPNG);
-        if (cbPNG)
-            memcpy(&aData.front(), pu8PNG, cbPNG);
-        if (pu8PNG)
-            RTMemFree(pu8PNG);
-    }
-    else
-    {
-        if (pu8PNG)
-            RTMemFree(pu8PNG);
-        return setError(VBOX_E_IPRT_ERROR,
-                        tr("Could not convert screenshot to PNG (%Rrc)"),
-                        vrc);
-    }
-
-    freeSavedDisplayScreenshot(pu8Data);
-
-    return rc;
+    return hr;
 }
 
