BitmapDecoder クラス

定義

ビットマップ コンテナー データと、最初のフレームからのデータへの読み取りアクセスを提供します。

public ref class BitmapDecoder sealed : IBitmapFrameWithSoftwareBitmap
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class BitmapDecoder final : IBitmapFrameWithSoftwareBitmap
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class BitmapDecoder : IBitmapFrameWithSoftwareBitmap
Public NotInheritable Class BitmapDecoder
Implements IBitmapFrameWithSoftwareBitmap
継承
Object Platform::Object IInspectable BitmapDecoder
属性
実装

Windows の要件

デバイス ファミリ
Windows 10 (10.0.10240.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v1.0 で導入)

デコーダー オブジェクトを作成する部分的な例を次に示します。 この例では、 Windows.Storage.Pickers.FileOpenPicker でファイルを選択したものとします。 ファイルの選択、デコーダーの作成、イメージのデコードの詳細については、「イメージング」を参照してください。

FileOpenPicker fileOpenPicker = new FileOpenPicker();
fileOpenPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
fileOpenPicker.FileTypeFilter.Add(".jpg");
fileOpenPicker.ViewMode = PickerViewMode.Thumbnail;

var inputFile = await fileOpenPicker.PickSingleFileAsync();

if (inputFile == null)
{
    // The user cancelled the picking operation
    return;
}

SoftwareBitmap softwareBitmap;

using (IRandomAccessStream stream = await inputFile.OpenAsync(FileAccessMode.Read))
{
    // Create the decoder from the stream
    BitmapDecoder decoder = await BitmapDecoder.CreateAsync(stream);

    // Get the SoftwareBitmap representation of the file
    softwareBitmap = await decoder.GetSoftwareBitmapAsync();
}

注釈

イメージ形式

BitmapDecoder は、次の形式をデコードできます。

  • JPEG
  • PNG
  • GIF
  • TIFF
  • BMP
  • ICO
  • JPEG-XR
  • Microsoft カメラ コーデック パックを使用して、インストールされているカメラの未加工の形式。

デコード形式の一覧については、「 BitmapEncoder 」トピックを参照してください。

BitmapDecoder クラスは IBitmapFrame を実装します。 コンテナー データと、最初のフレームからのデータへのアクセスを提供します。 これにより、アプリケーションは、別の BitmapFrame を取得することなく、最も一般的なシナリオを実現できます。

バージョン履歴

Windows のバージョン SDK バージョン 追加された値
1809 17763 HeifDecoderId
1809 17763 WebpDecoderId

プロパティ

BitmapAlphaMode

最初のフレームの既定のアルファ モード。

BitmapContainerProperties

コンテナービットマッププロパティへのアクセスを提供します。

BitmapPixelFormat

最初のフレームに最適なピクセル形式。

BitmapProperties

最初のフレーム内のメタデータの読み取り専用ビュー。

BmpDecoderId

BMP デコーダーの一意識別子。

DecoderInformation

ビットマップ デコーダーに関する情報。

DpiX

1 インチあたりのドット単位での最初のフレームの水平方向の解像度。

DpiY

1 インチあたりのドット単位での最初のフレームの垂直方向の解像度。

FrameCount

イメージ ファイル内のフレーム数。

GifDecoderId

GIF デコーダーの一意識別子。

HeifDecoderId

HEIF デコーダーの一意識別子。

IcoDecoderId

ICO デコーダーの一意識別子。

JpegDecoderId

JPEG デコーダーの一意識別子。

JpegXRDecoderId

JPEG-XR デコーダーの一意識別子。

OrientedPixelHeight

EXIF 方向がビットマップに適用された後の最初のフレームの高さ (ピクセル単位)。

OrientedPixelWidth

EXIF 方向がビットマップに適用された後の最初のフレームの幅 (ピクセル単位)。

PixelHeight

最初のフレームの高さ (ピクセル単位)。

PixelWidth

最初のフレームの幅 (ピクセル単位)。

PngDecoderId

PNG デコーダーの一意識別子。

TiffDecoderId

TIFF デコーダーの一意識別子。

WebpDecoderId

WebP デコーダーの一意識別子。

メソッド

CreateAsync(Guid, IRandomAccessStream)

特定のビットマップ コーデックを使用して新しい BitmapDecoder を非同期に作成し、ストリームを使用して初期化します。

CreateAsync(IRandomAccessStream)

新しい BitmapDecoder を非同期に作成し、ストリームを使用して初期化します。

GetDecoderInformationEnumerator()

システムにインストールされているビットマップ デコーダーとその情報。

GetFrameAsync(UInt32)

イメージ ファイルからフレームを非同期に取得します。

GetPixelDataAsync()

フレームのピクセル データを非同期に要求します。

GetPixelDataAsync(BitmapPixelFormat, BitmapAlphaMode, BitmapTransform, ExifOrientationMode, ColorManagementMode)

指定したパラメーターを使用して、フレームのピクセル データを非同期に要求します。

GetPreviewAsync()

プレビュー イメージを含むストリームを非同期的に返します。

GetSoftwareBitmapAsync()

デコードされたビットマップの SoftwareBitmap 表現を非同期に取得します。

GetSoftwareBitmapAsync(BitmapPixelFormat, BitmapAlphaMode)

デコードされたビットマップの SoftwareBitmap 表現を非同期に取得します。

GetSoftwareBitmapAsync(BitmapPixelFormat, BitmapAlphaMode, BitmapTransform, ExifOrientationMode, ColorManagementMode)

デコードされたビットマップの SoftwareBitmap 表現を非同期に取得します。

GetThumbnailAsync()

サムネイル画像を含むストリームを非同期的に返します。

適用対象

こちらもご覧ください