Search Apache POI

HPSF THUMBNAIL HOW-TO

The VT_CF Format

Thumbnail information is stored as a VT_CF, or Thumbnail Variant. The Thumbnail Variant is used to store various types of information in a clipboard. The VT_CF can store information in formats for the Macintosh or Windows clipboard.

There are many types of data that can be copied to the clipboard, but the only types of information needed for thumbnail manipulation are the image formats.

The VT_CF structure looks like this:

Element: Clipboard Size Clipboard Format Tag Clipboard Data
Size: 32 bit unsigned integer (DWord) 32 bit signed integer (DWord) variable length (byte array)

The Clipboard Size refers to the size (in bytes) of Clipboard Data (variable size) plus the Clipboard Format (four bytes).

Clipboard Format Tag has four possible values:

Value Identifier Description
-1L CFTAG_WINDOWS a built-in Windows© clipboard format value
-2L CFTAG_MACINTOSH a Macintosh clipboard format value
-3L CFTAG_FMTID a format identifier (FMTID) This is rarely used.
0L CFTAG_NODATA No data This is rarely used.

Windows Clipboard Data

Windows clipboard data has four image formats for thumbnails:

Value Identifier Description
3 CF_METAFILEPICT Windows metafile format - recommended
8 CF_DIB Device Independent Bitmap
14 CF_ENHMETAFILE Enhanced Windows metafile format
2 CF_BITMAP Bitmap - Obsolete - Use CF_DIB instead

Windows Metafile Format

The most common format for thumbnails on the Windows platform is the Windows metafile format. The Clipboard places and extra header in front of a the standard Windows Metafile Format data.

The Clipboard Data byte array looks like this when an image is stored in Windows' Clipboard WMF format.

Identifier CF_METAFILEPICT mm width height handle WMF data
Size 32 bit unsigned int 16 bit unsigned(?) int 16 bit unsigned(?) int 16 bit unsigned(?) int 16 bit unsigned(?) int byte array - variable length
Description Clipboard WMF Mapping Mode Image Width Image Height handle to the WMF data array in memory, or 0 standard WMF byte stream

Device Independent Bitmap

FIXME: Describe the Device Independent Bitmap format!

Macintosh Clipboard Data

FIXME: Describe the Macintosh clipboard formats!

by Drew Varner