Table 1 lists the Standard canonical encoder options that all WIC-enabled encoders support if applicable.
Table 1: Standard Canonical Encoder Options
Table 2 lists the Microsoft canonical encoder options.
Table 3 lists the LEAD-specific encoder options.
For LEAD Jpeg2000 encoder options, refer to LEAD Bitmap Encoder Property Bag: Jpeg2000 Specific Options.
For LEAD Jbig2 encoder options, refer to LEAD Bitmap Encoder Property Bag: Jbig2 Specific Options.
For LEAD XPS (XML Paper Specification) encoder options, refer to LEAD Bitmap Encoder Property Bag: XPS Specific Options.
Property Name VARTYPE Value Applicable Codecs ImageQuality VT_R4 0-1.0 Jpeg CompressionQuality VT_R4 0-1.0 Tiff Lossless VT_BOOL TRUE, FALSE WMPhoto BitmapTransform VT_UI1 WICBitmapTransformOptions Jpeg
Table 2: Microsoft Canonical Encoder Options
Property Name VARTYPE Value Applicable Codecs InterlaceOption VT_BOOL On/Off Png TIFFCompressionMethod VT_UI1 WICTiffCompressionOption Tiff Luminance VT_UI4/VT_ARRAY 64 Entries (DCT) Jpeg Chrominance VT_UI4/VT_ARRAY 64 Entries (DCT) Jpeg SuppressApp0 VT_BOOL Jpeg
Table 3: LEAD Encoder Options
Property Name VARTYPE Default Value Applicable LEAD Encoders Description SubFormat VT_I4 WICLeadSubFormat All Encoders For more information, refer to the IWICLeadBitmapEncoder::GetSubFormats method. QualityFactor VT_I4 2 Cmp, Tiff, Jpeg, Abc, Ecw, Fpx For more information, refer to QualityFactor. FixedPalette VT_BOOL VARIANT_FALSE All Encoders If VARIANT_TRUE, the function uses the fixed palette for images that are saved as 8 bits per pixel or less. OptimizedPalette VT_BOOL VARIANT_TRUE All Encoders If VARIANT_TRUE, the function uses the individual image's optimized palette for images that are saved as 8 bits per pixel or less. NoPalette VT_BOOL VARIANT_FALSE Tiff
PngIf VARIANT_TRUE, a TIFF or PNG file will be saved as grayscale, without a palette. PreservePalette VT_BOOL VARIANT_FALSE Tiff If VARIANT_TRUE, the palette will be preserved when saving TIFF CCITT files (might decrease the compression ratio) DitherType VT_UI4 CRF_NODITHERING All Encoders One of the WICLeadDitherType constants. UseImageFileDirectoryOffset VT_BOOL VARIANT_FALSE Tiff If VARIANT_TRUE, the ImagefileDirectoryOffset property is valid. ImageFileDirectoryOffset VT_I4 0 Tiff Offset within a TIFF file where a page starts. This serves as a reference page for saving pages to a large TIFF file. According to TIFF specifications, the minimum value for the first Image File Directory (IFD) offset is 8.
NoLzwAutoClear VT_BOOL VARIANT_FALSE Gif, Tiff If VARIANT_TRUE, CLEAR codes will not be automatically inserted during LZW compression. NoPageNumber VT_BOOL VARIANT_FALSE Tiff If VARIANT_TRUE, do not update and save the PageNumber tag associated with the pages of a multi-page TIFF file. NoSubFileType VT_BOOL VARIANT_FALSE Tiff
TifxIf VARIANT_TRUE, a subfile type TIFF tag will not be written when writing any TIFF file. UsePhotometricInterpretation VT_BOOL VARIANT_FALSE Tiff If VARIANT_TRUE, PhotometricInterpretation will be used when saving TIFF files. PhotometricInterpretation VT_I4 0 Tiff Photometric interpretation that should be saved in the file instead of the regular value. SavePlanar VT_BOOL VARIANT_FALSE Tiff If VARIANT_TRUE, TIF CMYK images will be saved as planar (instead of chunky) images. UseTileSize VT_BOOL VARIANT_FALSE Tiff If VARIANT_TRUE, TileWidth and TileHeight property bag values will be used when saving TIFF files. TileWidth VT_UI4 0 Tiff Width of the tile to use when saving TIFF files. This value is in pixels.
TileHeight VT_UI4 0 Tiff Height of the tile to use when saving TIFF files. This value is in pixels.
UsePredictor VT_BOOL VARIANT_FALSE Tiff If VARIANT_TRUE, a predictor will be used when saving LZW data. This is for TIF LZW or Raw LZW data that is 8 bpp or more. This flag is ignored if the LZW data is less than 8 bpp. ReverseBits VT_BOOL VARIANT_FALSE Tiff
Fax
TifxIf VARIANT_TRUE, the bit order will be reversed when writing CCITT Group 3 and 4 files and RAW uncompressed data, so that the least significant bit (LSB) is first. UseGlobalBackground VT_BOOL VARIANT_FALSE Gif If VARIANT_TRUE, causes a GIF file to be saved with the global background color specified by the GlobalBackground field. GlobalBackground VT_UI4 RGB(000) Gif Background color of images in a multi-page GIF file. This property is used only if UseGlobalBackground is VARIANT_TRUE UseGlobalPalette VT_BOOL VARIANT_FALSE Gif If VARIANT_TRUE, causes a GIF file to be saved with the global palette specified by the GlobalPalette field. GlobalPalette VT_ARRAY | VT_UI4 1 Gif Palette for images in a multi-page GIF file. This property is used only if UseGlobalPalette is VARIANT_TRUE. Interlaced VT_BOOL VARIANT_FALSE Gif If VARIANT_TRUE, causes a GIF file to be saved as an interlaced file. FixedPaletteStamp VT_BOOL VARIANT_FALSE Jpeg, Cmp If VARIANT_TRUE, causes a Cmp or JPEG stamp image to be saved with a fixed palette. YCCStamp VT_BOOL VARIANT_FALSE Exif If VARIANT_TRUE, causes an Exif stamp image to be saved with YCbCr color space. JpegStamp VT_BOOL VARIANT_FALSE Cmp
Jpeg
ExifIf VARIANT_TRUE, saves JPEG compressed stamps. SaveOldJtif VT_BOOL VARIANT_FALSE Jpeg If VARIANT_TRUE, writes old style Jtif files. NoPageNumber VT_BOOL VARIANT_FALSE Tiff If VARIANT_TRUE, does not update and save the PageNumber tag associated with the pages of a multi-page TIFF file. MotorolaOrder VT_BOOL VARIANT_FALSE Cmp
Cmw
Tifx
TiffIf VARIANT_TRUE, saves files in Motorola byte order when possible. WithoutTimeStamp VT_BOOL VARIANT_FALSE Png If VARIANT_TRUE, saves the file without a time stamp. PdfTextEncodingAsciiBase85 VT_BOOL VARIANT_FALSE If VARIANT_TRUE, uses PDF, ASCII BASE 85 text encoding for image data. PdfTextEncodingAsciiHex VT_BOOL VARIANT_FALSE If VARIANT_TRUE, uses PDF, ASCII HEX text encoding for image data. PdfTextEncodingMask VT_BOOL VARIANT_FALSE If VARIANT_TRUE, use a Mask of the flags for PDF text encoding. PdfSaveUseBitmapDpi VT_BOOL VARIANT_FALSE If VARIANT_TRUE, use the bitmap DPI in calculating page dimensions when saving a PDF file. PdfSaveLowMemoryUsage VT_BOOL VARIANT_FALSE If VARIANT_TRUE, tries to use less memory when creating a PDF file with JPEG or Fax compression. Passes VT_I4 0 Jpeg
Cmp
Possible values when saving:
Value
Meaning
Any positive number
Save the file as a progressive file with the specified number of passes.
0
Save the file as an ordinary JPEG or LEAD Cmp file (not a progressive file).
Any negative number
Save the file as a progressive file with the LEADTOOLS default number of passes.
Possible values when saving non-progressive files:
Value
Meaning
0
Save the file with fixed Huffman tables (faster save, lower compression).
<>0
Save the file with optimized Huffman tables (2-pass compression, lower speed, higher compression)
GlobalWidth VT_I4 0 Gif Width of images in a multi-page GIF file GlobalHeight VT_I4 0 Gif Height of images in a multi-page GIFfile SaveWithStamp VT_BOOL VARIANT_FALSE Jpeg
Exif
CmpIf VARIANT_TRUE, causes a Cmp, JPEG, or Exif file to be saved with a stamp (thumbnail image), in addition to the normal image. If VARIANT_TRUE, use StampWidth, StampHeight, and StampBits property bag values. StampWidth VT_UI4 0 Jpeg
Exif
CmpWidth, in pixels, of the stamp image being saved. StampHeight VT_UI4 0 Jpeg
Exif
CmpHeight, in pixels, of the stamp image being saved. StampBits VT_UI4 0 Jpeg
Exif
CmpBits per pixel of the stamp image being saved. Password VT_ARRAY | VT_UI2 255 Password for saving encrypted files.
AlphaInit VT_BOOL VARIANT_FALSE All Encoders If VARIANT_TRUE, initializes the alpha channel for 32 or 64-bit color images) to all ones (0xFF for 8-bit alpha channels and 0xFFFF for 16-bit alpha channels). Without this flag, a created alpha channel initializes to zeros.
Reference
LEAD WIC-Enabled Codecs Overview
Registering a LEAD WIC-Enabled Codec
LEAD Bitmap Encoder Property Bag: Jpeg2000 Specific Options
LEAD Bitmap Encoder Property Bag: Jbig2 Specific Options
LEAD Bitmap Encoder Property Bag: XPS Specific Options
// This example shows how to save a JPEG file with options using the property bag // Then the file is saved with a quality factor of 100 (medium) // * SubFormat YUV:4:1:1 // * QualityFactor 100 // Refer to the Example Requirements for help in running this sample HRESULT IWICLeadBitmapEncoder_PropertyBag(HWND hWnd, WCHAR *pszOut) { HRESULT hr = S_OK; IWICImagingFactory *piImagingFactory = NULL; IWICBitmapEncoder *piBitmapEncoder = NULL; IWICBitmapFrameEncode *piBitmapFrameEncode = NULL; IWICStream *piStream = NULL; IPropertyBag2 *piPropertyBag = NULL; CString csExampleName; GUID guidContainerFormat = GUID_ContainerFormatLeadJpeg; WICPixelFormatGUID guidPixelFormat = GUID_WICPixelFormat24bppBGR; csExampleName.Format(L"IWICLeadBitmapEncoder_PropertyBag\nThis example creates a Jpeg file (%s) with SubFormat WICLeadSubFormatJpeg411 and QFactor 100", pszOut); // Create a LEAD Jpeg Bitmap Encoder IFS(CoCreateInstance(CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, IID_IWICImagingFactory, (LPVOID*) &piImagingFactory)); IFS(piImagingFactory->CreateStream(&piStream)); IFS(piStream->InitializeFromFilename(pszOut, GENERIC_WRITE)); IFS(piImagingFactory->CreateEncoder(guidContainerFormat, NULL, &piBitmapEncoder)); IFS(piBitmapEncoder->Initialize(piStream, WICBitmapEncoderNoCache)); IFS(piBitmapEncoder->CreateNewFrame(&piBitmapFrameEncode, &piPropertyBag)); // This is how you customize the LEAD WIC Encoder property bag. if(SUCCEEDED(hr)) { ULONG uCount = 0; hr = piPropertyBag->CountProperties(&uCount); PROPBAG2 *pBag = new PROPBAG2[uCount]; ZeroMemory(pBag, sizeof(*pBag)); VARIANT *pValue = new VARIANT[uCount]; ZeroMemory(pValue, sizeof(*pValue)); HRESULT *pErrors = new HRESULT[uCount]; ZeroMemory(pErrors, sizeof(*pErrors)); IFS(piPropertyBag->GetPropertyInfo(0, uCount, pBag, &uCount)); IFS(piPropertyBag->Read(uCount, pBag, NULL, pValue, pErrors)); if (SUCCEEDED(hr)) { for (ULONG u = 0; u < uCount; u++) { if (wcscmp(pBag[u].pstrName, L"JpegSubFormat")== 0) { pValue[u].intVal = WICLeadSubFormatJpeg411; piPropertyBag->Write(1, pBag+u, pValue+u); } else if (wcscmp(pBag[u].pstrName, L"QualityFactor")== 0) { pValue[u].intVal = 100; piPropertyBag->Write(1, pBag+u, pValue+u); } } } //Cleanup DELETE_POINTER(pBag); DELETE_POINTER(pValue); DELETE_POINTER(pErrors); IFS(piBitmapFrameEncode->Initialize(piPropertyBag)); } // Now create the image data that we will write UINT uiWidth = 256; UINT uiHeight = 256; IFS(piBitmapFrameEncode->SetSize(uiWidth, uiHeight)); WICPixelFormatGUID formatGUID = GUID_WICPixelFormat24bppBGR; IFS(piBitmapFrameEncode->SetPixelFormat(&formatGUID)); if (SUCCEEDED(hr)) { // We're expecting to write out 24bppRGB. Fail if the encoder cannot do it. hr = IsEqualGUID(formatGUID, GUID_WICPixelFormat24bppBGR) ? S_OK : E_FAIL; } if (SUCCEEDED(hr)) { UINT cbStride = (uiWidth * 24 + 7)/8; UINT cbBufferSize = uiHeight * cbStride; BYTE *pbBuffer = new BYTE[cbBufferSize]; if (pbBuffer != NULL) { for (UINT i = 0; i < cbBufferSize; i++) { pbBuffer[i] = static_cast<BYTE>(rand()); } hr = piBitmapFrameEncode->WritePixels(uiHeight, cbStride, cbBufferSize, pbBuffer); delete[] pbBuffer; } else { hr = E_OUTOFMEMORY; } } // Commit the changes to the stream IFS(piBitmapFrameEncode->Commit()); IFS(piBitmapEncoder->Commit()); RELEASE_INTERFACE(piBitmapFrameEncode); RELEASE_INTERFACE(piBitmapEncoder); RELEASE_INTERFACE(piImagingFactory); RELEASE_INTERFACE(piPropertyBag); RELEASE_INTERFACE(piStream); MessageBox(hWnd, csExampleName, csExampleName, MB_OK); return hr; }