RAW資料的標頭如下:
DWORD Tag; // must contain 'WRAW' (single byte ASCII characters)
DWORD Version; // must contain 0x00010000
DWORD HeaderSize; // contains amount of valid bytes in header
DWORD XRes; // X (horizontal) resolution, in DPI
DWORD YRes; // Y (vertical) resolution, in DPI
DWORD XExtent; // image width, in pixels
DWORD YExtent; // image height, in pixels
DWORD BytesPerLine; // used only for uncompressed image data, 0 (unknown) for compressed data
DWORD BitsPerPixel; // number of bits per pixel (all channels)
DWORD ChannelsPerPixel; // number of color channels (samples) within a pixel
DWORD DataType; // current WIA_IPA_DATATYPE value describing the image
BYTE BitsPerChannel[8]; // up to 8 channels per pixel, use as many as needed
DWORD Compression; // current WIA_IPA_COMPRESSION value
DWORD PhotometricInterp; // current WIA_IPS_PHOTOMETRIC_INTERP value
DWORD LineOrder; // image line order as a WIA_LINE_ORDER value
DWORD RawDataOffset; // offset position (in bytes, starting from 0) for the raw image data
DWORD RawDataSize; // size of raw image data, in bytes
DWORD PaletteOffset; // offset position (in bytes, starting from 0) for the palette (0 if none)
DWORD PaletteSize; // size, in bytes, of color palette table (0 if no palette is required)
其他標頭欄位說明
DWORD Compression
允許壓縮原始格式,例如用於壓縮傳真傳輸的 Nikon 壓縮 NEF 和無標頭壓縮資料(第 3.1、3.2d、4 組)。 此欄位的值會是WIA_IPA_COMPRESSION常數,可能是特定於特定於特殊應用程式的廠商。 預設值為 WIA_COMPRESSION_NONE。
Compression Examples:
G4 壓縮資料 (WIA_COMPRESSION_G4) 可以在 TIFF 檔案 (WiaImgFmt_TIFF) 或使用原始格式 (WiaImgFmt_RAW) 中傳輸。
JPEG 壓縮資料 (WIA_COMPRESSION_JPEG) 可以使用 JFIF 格式 (WiaImgFmt_JPEG)、EEXIF 格式 (WiaImgFmt_EXIF) 或 TIFF 格式 (WiaImgFmt_TIFF) 進行傳輸。 在使用原始格式 (WiaImgFmt_RAW) 的傳輸中,無法傳輸以交換格式(JFIF、EEXIF)之一格式化的 JPEG 資料 - 相反,必須使用其他 JPEG 相容格式之一。
For more information on the WIA compression constants, see the WIA_IPA_COMPRESSION property.
DWORD PhotometricInterp
描述所傳輸影像的光度解譯。 黑白 (1bpp) 和灰階 (4bpp 或更多) 影像需要此欄位。 這些影像需要指出白色和黑色的值,WIA_PHOTO_WHITE_1(其中白色為 1,黑色為 0)或WIA_PHOTO_WHITE_0(其中白色為 0,黑色為 1)。 對於彩色影像,此欄位是選用的。
DWORD LineOrder
描述影像資料中的線/列是從上到下還是從下到上排序。 Two new constants were defined in wiadef.h for this:
#define WIA_LINE_ORDER_TOP_TO_BOTTOM 0x00000001
#define WIA_LINE_ORDER_BOTTOM_TO_TOP 0x00000002
沒有為此定義新的屬性。 這不是可設定的掃描設定。 LingOrder only matters when executing image data transfers.
DWORD RawDataSize
指出標頭後面原始資料的大小 (以位元組為單位) (不包括選擇性調色盤)。 應用程式可以使用此欄位來驗證假定成功的影像傳輸完成。 當迷你驅動程式在傳輸開始時不知道這項資訊時 (,而且標頭會寫入資料流程) ,例如,當使用自動框線偵測掃描影像時,迷你驅動程式應該需要在影像資料傳輸結束時填入此欄位,類似於處理 XExtent 和 YExtent 欄位的方式。
DWORD PaletteOffset
包含位移量,以位元組為單位,調色盤在資料流中開始;此偏移量從標頭結束的位置開始(從位置零處)。 調色盤和原始圖像數據可以以任何順序跟隨原始標頭,並且可以在不需要時省略調色盤。
DWORD PaletteSize
包含調色盤的大小 (以位元組為單位)。 當不需要附加至原始影像數據的調色盤時,迷你驅動程式應該將此欄位設定為 0。 此欄位與選用區中的項目數無關。
Black and white and grayscale data can omit the palette (because the information required to build the palette is contained in the PhotometricInterpretation field) or supply an optimized palette along with the PhotometricInterpretation field.
For indexed images, the number of entries in the color palette is dictated by the current BitsPerPixel value (2 ^ BitsPerPixel. For example, 2 entries for 1bpp, 16 entries for 4bpp, 256 entries for 8bpp). The format of the palette entries would be dictated by the number of entries in BitsPerChannel field (the number of fields/channels in each palette entry) and BitsPerChannel values (each field would contain exactly the value specified in the BitsPerChannel field for the respective channel). 每一個調色盤項目欄位都必須以 BYTE 對齊。