StorageFile.GetThumbnailAsync 方法

定義

多載

GetThumbnailAsync(ThumbnailMode, UInt32, ThumbnailOptions)

擷取檔案的調整縮圖影像,其用途取決於縮圖、要求的大小和指定的選項。

GetThumbnailAsync(ThumbnailMode)

擷取檔案的調整縮圖影像,由縮圖的用途決定。

GetThumbnailAsync(ThumbnailMode, UInt32)

擷取檔案的調整縮圖影像,取決於縮圖和要求的大小。

GetThumbnailAsync(ThumbnailMode, UInt32, ThumbnailOptions)

擷取檔案的調整縮圖影像,其用途取決於縮圖、要求的大小和指定的選項。

public:
 virtual IAsyncOperation<StorageItemThumbnail ^> ^ GetThumbnailAsync(ThumbnailMode mode, unsigned int requestedSize, ThumbnailOptions options) = GetThumbnailAsync;
/// [Windows.Foundation.Metadata.Overload("GetThumbnailAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<StorageItemThumbnail> GetThumbnailAsync(ThumbnailMode const& mode, uint32_t const& requestedSize, ThumbnailOptions const& options);
[Windows.Foundation.Metadata.Overload("GetThumbnailAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<StorageItemThumbnail> GetThumbnailAsync(ThumbnailMode mode, uint requestedSize, ThumbnailOptions options);
function getThumbnailAsync(mode, requestedSize, options)
Public Function GetThumbnailAsync (mode As ThumbnailMode, requestedSize As UInteger, options As ThumbnailOptions) As IAsyncOperation(Of StorageItemThumbnail)

參數

mode
ThumbnailMode

描述縮圖用途的列舉值,並決定縮圖影像的調整方式。

如需選擇最佳縮圖模式的指引,請參閱 縮圖的指導方針和檢查清單

requestedSize
UInt32

unsigned int

uint32_t

要求的大小,以圖元為單位,為縮圖最長邊緣。 Windows 會使用 requestedSize 作為指南,並嘗試調整縮圖影像,而不會降低影像的品質。

如果 Windows 找不到可調整以符合要求大小的縮圖影像,可能會傳回較大的縮圖。 如果沒有較大的縮圖可用,可能會傳回小於要求大小的縮圖影像。

options
ThumbnailOptions

列舉值,描述用來擷取縮圖影像所需的行為。 指定的行為可能會影響影像的大小和/或品質,以及擷取縮圖影像的速度。

傳回

當此方法成功完成時,它會傳回代表縮圖影像的 StorageItemThumbnail ,如果沒有與檔案相關聯的縮圖影像,則傳回 null

實作

M:Windows.Storage.IStorageItemProperties.GetThumbnailAsync(Windows.Storage.FileProperties.ThumbnailMode,System.UInt32,Windows.Storage.FileProperties.ThumbnailOptions) M:Windows.Storage.IStorageItemProperties.GetThumbnailAsync(Windows.Storage.FileProperties.ThumbnailMode,unsigned int,Windows.Storage.FileProperties.ThumbnailOptions) M:Windows.Storage.IStorageItemProperties.GetThumbnailAsync(Windows.Storage.FileProperties.ThumbnailMode,uint32_t,Windows.Storage.FileProperties.ThumbnailOptions)
屬性

範例

此範例示範如何使用 [storageFile.getThumbnailAsync (] 模式、requestedSize、選項) 方法來擷取檔案的縮圖。

storageFile.getThumbnailAsync(
    Windows.Storage.FileProperties.ThumbnailMode.musicView,
    100,
    Windows.Storage.FileProperties.ThumbnailOptions.useCurrentScale).then(
        function (storageItemThumbnail) {
            // Add code to process thumbnail
        }
    );

在範例中,您必須有代表檔案) 的 StorageFile 物件 (storageFile ,才能使用其中一個 StorageFile.GetThumbnailAsync 方法。

備註

雖然 GetThumbnailAsync 遵守縮圖磁片快取所支援的大小上限,但 GetScaledImageAsThumbnailAsync 可以擷取大於縮圖磁片快取支援的縮圖。 GetScaledImageAsThumbnailAsync 提供最佳品質,但如果縮圖大小太大,則不會影響效能。

另請參閱

適用於

GetThumbnailAsync(ThumbnailMode)

擷取檔案的調整縮圖影像,由縮圖的用途決定。

public:
 virtual IAsyncOperation<StorageItemThumbnail ^> ^ GetThumbnailAsync(ThumbnailMode mode) = GetThumbnailAsync;
/// [Windows.Foundation.Metadata.Overload("GetThumbnailAsyncOverloadDefaultSizeDefaultOptions")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<StorageItemThumbnail> GetThumbnailAsync(ThumbnailMode const& mode);
[Windows.Foundation.Metadata.Overload("GetThumbnailAsyncOverloadDefaultSizeDefaultOptions")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<StorageItemThumbnail> GetThumbnailAsync(ThumbnailMode mode);
function getThumbnailAsync(mode)
Public Function GetThumbnailAsync (mode As ThumbnailMode) As IAsyncOperation(Of StorageItemThumbnail)

參數

mode
ThumbnailMode

描述縮圖用途的列舉值,並決定縮圖影像的調整方式。

如需選擇最佳縮圖模式的指引,請參閱 縮圖的指導方針和檢查清單

傳回

當此方法成功完成時,它會傳回代表縮圖影像的 StorageItemThumbnail ,如果沒有與檔案相關聯的縮圖影像,則傳回 null

實作

屬性

備註

雖然 GetThumbnailAsync 遵守縮圖磁片快取所支援的大小上限,但 GetScaledImageAsThumbnailAsync 可以擷取大於縮圖磁片快取支援的縮圖。 GetScaledImageAsThumbnailAsync 提供最佳品質,但如果縮圖大小太大,則不會影響效能。

另請參閱

適用於

GetThumbnailAsync(ThumbnailMode, UInt32)

擷取檔案的調整縮圖影像,取決於縮圖和要求的大小。

public:
 virtual IAsyncOperation<StorageItemThumbnail ^> ^ GetThumbnailAsync(ThumbnailMode mode, unsigned int requestedSize) = GetThumbnailAsync;
/// [Windows.Foundation.Metadata.Overload("GetThumbnailAsyncOverloadDefaultOptions")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<StorageItemThumbnail> GetThumbnailAsync(ThumbnailMode const& mode, uint32_t const& requestedSize);
[Windows.Foundation.Metadata.Overload("GetThumbnailAsyncOverloadDefaultOptions")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<StorageItemThumbnail> GetThumbnailAsync(ThumbnailMode mode, uint requestedSize);
function getThumbnailAsync(mode, requestedSize)
Public Function GetThumbnailAsync (mode As ThumbnailMode, requestedSize As UInteger) As IAsyncOperation(Of StorageItemThumbnail)

參數

mode
ThumbnailMode

描述縮圖用途的列舉值,並決定縮圖影像的調整方式。

如需選擇最佳縮圖模式的指引,請參閱 縮圖的指導方針和檢查清單

requestedSize
UInt32

unsigned int

uint32_t

要求的大小,以圖元為單位,為縮圖最長邊緣。 Windows 會使用 requestedSize 作為指南,並嘗試調整縮圖影像,而不會降低影像的品質。

如果 Windows 找不到可調整以符合要求大小的縮圖影像,可能會傳回較大的縮圖。 如果沒有較大的縮圖可用,可能會傳回小於要求大小的縮圖影像。

傳回

當此方法成功完成時,它會傳回代表縮圖影像的 StorageItemThumbnail ,如果沒有與檔案相關聯的縮圖影像,則傳回 null

實作

M:Windows.Storage.IStorageItemProperties.GetThumbnailAsync(Windows.Storage.FileProperties.ThumbnailMode,System.UInt32) M:Windows.Storage.IStorageItemProperties.GetThumbnailAsync(Windows.Storage.FileProperties.ThumbnailMode,unsigned int) M:Windows.Storage.IStorageItemProperties.GetThumbnailAsync(Windows.Storage.FileProperties.ThumbnailMode,uint32_t)
屬性

備註

雖然 GetThumbnailAsync 遵守縮圖磁片快取所支援的大小上限,但 GetScaledImageAsThumbnailAsync 可以擷取大於縮圖磁片快取支援的縮圖。 GetScaledImageAsThumbnailAsync 提供最佳品質,但如果縮圖大小太大,則不會影響效能。

另請參閱

適用於