File Formats: Raw

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

NOTE: Writing/Saving LZW Image data is supported, but not reading/loading LZW files. 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 the 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 palletized and a palette must be generated. If this is the case, pass a valid palette with 1 << bits/pixel (2 ^ BitsPerPixel) 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"

To load a raw 12-bit and 16-bit extended grayscale image, set the Codecs.InformationEventArgs.Order property to RasterByteOrder.Gray and the CodecsLoadInformationEventArgs.LeastSignificantBitFirst Property accordingly. For signed image data, set the CodecsLoadInformationEventArgs.Signed property to true.

RAW headerless image data and raw FAX load and save are supported. To load, use the Raw codec (Leadtools.Codecs.Raw.dll).

Saving a file with the RAW filter When saving raw uncompressed data, the raw data will 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 object.

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 CodecsRawSaveOptions.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).

For an example, refer to: RasterCodecs.LoadInformation Event.

Platform Support

Extension Module Value Win32 Win64 Net32 Net64 Linux Android Apple UWP MimeType Friendly Name
Raw RAW 153 image/x-raw Raw Image Data

For a complete list for supported file formats, see Summary of All Supported File Formats.

For details of the file formats supported across products and platforms, refer to File Format Comparison Chart.

Help Version 21.0.2021.11.1
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Imaging, Medical, and Document
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.