Bitmap Sources Overview

This topic introduces bitmap sources, a core Windows Imaging Component (WIC) component that represents the bitmap pixels of an image.

This topic contains the following sections.

Bitmap Sources

The IWICBitmapSource component is the basic building block of WIC and represents a single set of pixels. A bitmap source can be an individual frame of a multiframe image, or it can be the result of a transform performed on a bitmap source. The IWICBitmapSource interface is the base of many of the primary WIC interfaces such as the decoder frame IWICBitmapFrameDecode and transform bitmap sources such as the IWICBitmapFlipRotator.

The following table describes the different bitmap source components provided by WIC.

Bitmap SourcesDescription
IWICBitmapFrameDecode Represents a decoder image frame.
IWICBitmap Provides writability and in-memory representation to bitmap sources.
IWICBitmapClipper Clips a bitmap source to a desired rectangle.
IWICBitmapFlipRotator Flips and/or rotates a bitmap source to a desired orientation.
IWICBitmapScaler Scales a bitmap source to a desired size.
IWICColorTransform Transforms the color context of a bitmap source.
IWICFormatConverter Converts the pixel format of a bitmap source.


Bitmap Frames

The most common IWICBitmapSource is the IWICBitmapFrameDecode. This interface is used to access the actual bitmap data of an image format. Many image formats only support a single bitmap frame, while other formats such as GIF and TIFF support multiple frames per image.

For an example on obtaining bitmap frames from an image, see the How to Retrieve the Frames of an Image topic.


An IWICBitmap adds the concepts of writability and static in-memory to bitmap sources. WIC bitmaps enables users to directly access the pixels of a bitmap source. This direct access is provided by the Lock method and supports any combination of read and/or write access to the bitmap pixels. Lock method locks the specified bitmap rectangle and provides an IWICBitmapLock object to access the pixels.

For an example using IWICBitmap and IWICBitmapLock objects, see the How to Modify the Pixels of a Bitmap Source topic.

Transform Bitmap Sources

WIC provides several IWICBitmapSource interfaces that transform the pixel data. Specifically, WIC provides bitmap source transforms for scaling, clipping, rotating, and flipping pixel data. These bitmap source transforms are IWICBitmapClipper, IWICBitmapScaler, and IWICBitmapFlipRotator. Each of these bitmap sources have a method to initialize and create a new transformed bitmap source. For example, the IWICBitmapClipper includes the Initialize method. This method initializes the clipper bitmap source with the clipped pixel data of the input bitmap source at the given WICRect.

The following how-to topics demonstrate different uses of the transform bitmap sources.

Pixel Format and Color Context Converters

WIC also provides bitmap sources converting the pixel format and color context of a bitmap source. WIC provides the IWICFormatConverter and IWICColorTransform for these operations.

IWICFormatConverter converts a given bitmap source from one pixel format to another.

For an example using the IWICFormatConverter, see the How to Draw a Bitmap Source Using Direct2D topic.

Drawing Bitmap Sources

WIC is a still image codec technology and is used to manage image data and metadata and does not inherently provide a way to render images. However, bitmap sources can be drawn using several Windows graphics technology such as Direct2D, Windows Graphics Device Interface (GDI), and Windows GDI+. Each of these technologies has a different level of interoperability with WIC. Direct2D provides direct interoperability through the ID2D1Bitmap interface and the ID2D1RenderTarget::CreateBitmapFromWicBitmap method while GDI and GDI+ require users to copy the bitmap source pixels into an Bitmaps.

The following example demonstrate how to draw bitmap sources by using Direct2D.

Related topics

Windows Imaging Component Overview
Encoding Overview
Other Resources
How to Write a WIC-Enabled CODEC