Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
File Formats: Raw

The RAW File Filter can be used to load and save raw uncompressed data. The raw data can have:

  • Any offset in the file
  • Any bits per pixel
  • Any width/height
  • Each line padded to 4 bytes
  • Any view perspective
  • BGR or RGB color order

Loading a file with the RAW filter

To load a raw fax file, you must subscribe to the event first. When the toolkit fails to recognize the image file format, it will fire this event. If you know the size of the fax image, then set the values in the CodecsLoadInformationEventArgs.Width and CodecsLoadInformationEventArgs.Height properties of the CodecsLoadInformationEventArgs object passed as the event data. To automatically detect the width and height of the fax file, set the CodecsLoadInformationEventArgs.Width and CodecsLoadInformationEventArgs.Height properties to -1.

To load raw uncompressed data, you must subscribe to this event first. When the toolkit fails to recognize the image file format, it will fire this event. Set the CodecsLoadInformationEventArgs.Format property to RasterImageFormat.Raw. Valid values must also be set for the following properties:

If each line of RAW data is padded so that the number of bytes is a multiple of 4 (as is the case with raw Windows BMP data), set the CodecsLoadInformationEventArgs.Pad4 property to true. Include an orientation in the CodecsLoadInformationEventArgs.ViewPerspective property in order for the image to use the proper orientation. For example, raw Windows BMP data is stored with a RasterViewPerspective.BottomLeft orientation. If the orientation is unknown, then set it to RasterViewPerspective.BottomLeft. If the raw data is 8 bits per pixel or less, then the image is palettized and a palette must be generated. If this is the case, pass a valid palette with 1 >gt; bits/pixel number of entries to the CodecsLoadInformationEventArgs.SetPalette method.

Set the correct color order in the CodecsLoadInformationEventArgs.Order property. For example, if the order of the data is BGR, then set this value to RasterByteOrder.Bgr.

For more information, refer to CodecsLoadInformationEventArgs

Saving a file with the RAW filter When saving raw uncompressed data, the raw data will be correspond to the width, height, bits per pixel, color order, and view perspective of the image. You can affect the way the raw data is saved by setting certain parameters in the CodecsOptions.Raw

The bits in each byte can be reversed by setting ReverseBits Each line of raw data can be padded so that the length is a multiple of four bytes by setting CodecsLoadInformationEventArgs.Pad4 to true. LEAD also supports saving Raw LZW data by passing RawLzw when saving the data. Please note that when this option is used, the view perspective is ignored. The main purpose of this option is to provide support for saving LZW images that are embedded in other file formats such as PDF. When using RAW data as 8 bits per pixel or less, it is necessary to pass the OptimizedPalette flag to disable any dithering prior to the save. Note that no palette information is saved in the RAW file. Consequently, after loading RAW data, it is necessary to supply a palette (refer to the Loading a file with the RAW filter section, above).