ImageGear assemblies require explicit initialization at application startup.
Initialization Required Ordering
The order in which these assemblies are initialized is important, because it defines format detection priority. The following order is recommended when initializing the assemblies needed in your application startup to ensure proper detection:
Camera Raw formats should be initialized before Common formats, because many camera raw formats use custom versions of TIFF. If the application initializes Common formats before Camera Raw formats, ImageGear can incorrectly detect Camera Raw files as TIFF. Advanced formats will usually be initialized last, to allow for faster detection of Camera Raw and Common formats. Office formats and XPS format have similar signatures in the file's header. To ensure proper detection, Office formats should be initialized before XPS if you need to add support for both of them.
Camera Raw Formats
Assembly: ImageGear.Formats.CameraRaw.dll
Supported Formats: CR2, CRW, DNG, Hasselblad RAW, Headerless , Imacon Raw, KodakRAW, LeicaRAW, MEF, MOS, MRW, NEF, ORF, PEF, PhaseOneRaw, RAF, SonyRaw
Headerless Camera Raw format doesn't have a file header, which makes its detection less reliable. Detection of this format in ImageGear is enabled by default. It is recommended that you move them to the end of the global formats list by adding the following piece of code below the initialization line:
Common File Formats
Assembly: ImageGear.Formats.Common.dll
Supported Formats: BMP, CLP, CUR, DIB, GIF, ICO, JFIF, JPEG, PNG, RAW, TIFF
The Common File Formats component additionally provides two alternative file format implementations for JPEG and PNG. These file filters are based on native binary code which is unlike the default filters implemented on .NET. The difference between default and native implementation of JPEG and PNG is discussed in Native JPEG & PNG Filters.
ImGearCommonFormats.Initialize() method initializes the file filter list with default JPEG and PNG filters. Update the filter list using ImGearFileFilters.Set(IImGearFormat format) method, which should be called after initialization to replace the default filters with native.
Advanced File Formats
Assembly: ImageGear.Formats.Advanced.dll
Supported Formats: BTR, CAL, CR2, CRW, CUT, DCX, GEM, IFF, IMG, IMR, IMT, IOCA, KFX, LV, MODCA, MSP, NCR, PBM, PCD, PCX, PGM, PNM, PPM, PSB, PSD, PTOCA, RAS, Scitex CT, SGI, TGA, WBMP, WPG, XBM, XPM, XWD
CUT format doesn't have a specific signature in the file's header, which makes its detection less reliable. Detection of this format in ImageGear is disabled by default. If you enable detection of this format, it is recommended that you move it to the end of the global formats list by adding the following piece of code below the initialization line:
PDF and PS Formats
Assembly: ImageGear.Formats.Pdf.dll
This assembly requires both initialization and termination. Furthermore, the ImGearPDF.Initialize method does not add PDF and PostScript formats to the global format filter list. PDF and PostScript formats should be added explicitly before initialization, see PDF and PS in the "Additional Support" section, below.
Simplified Metadata
Assembly: ImageGear.Formats.SimplifiedMetadata.dll
Supported Metadata Structures: EXIF Metadata Structure, IPTC Metadata Structure, TIFF Metadata Structure, XMP Metadata Structure
Additional Support
The following ImageGear components also need to be explicitly added at application startup if required. The goal is to load the ImageGear capabilities for working with a specific set of formats that your application aims to process and that are not included in the assemblies initialized.
Before adding any of these components, you need to have at least initialized Common Formats.
PDF and PS
Namespace: ImageGear.Formats.PDF
Supported Formats: PDF, PS
CAD/Vector Formats
Namespaces:
ImageGear.Formats.CAD
ImageGear.Formats.CGM
ImageGear.Formats.DWF
ImageGear.Formats.HPGL
ImageGear.Formats.SVG
ImageGear.Formats.U3D
Supported Formats: CGM, DGN, DWF, DWG, DXF, HPGL, SVG , U3D
Medical (DICOM)
Namespace: ImageGear.Formats.DICOM
Supported Formats: DICOM
Optimized JPEG and JPEG 2000
Namespace: ImageGear.Formats.JPEG2K
Supported Formats: JPEG, JPEG 2000 (Part-1 JP2, Part-2 JPX and Codestream J2K)
Office
Namespace: ImageGear.Formats.Office
Supported Formats: DOCX, DOC, PPTX, PPT, XLSX, XLS
XPS
Assembly: ImageGear.Wpf.dll
Namespace: ImageGear.WPF.XPS
Supported Formats: XPS
Office formats and XPS format have similar signatures in the file's header. To ensure proper detection, Office formats should be initialized before XPS if you need to add support for both of them. To use XPS, you need to add the assembly ImageGear.Wpf.dll.
Global and Local Initialization
After initializing ImageGear format filters, we can specify filter control parameters. Many format filters in ImageGear have control parameters that affect filter operations, such as image reading and writing. Those parameters may be declared by the format specification, or they may be specific to the format implementation by ImageGear. There are two ways to specify filter control parameters:
Specify Parameters Globally
This affects all format reading and writing operations, and threads in the process. Use the Filters static property of the ImGearFileFormats class to set parameters globally:
Specify Parameters Locally
This affects only one reading or writing operation, and thus can be used for setting different parameters in different threads. To specify local parameters, create an instance of ImGearFileFilters class, assign it to ImGearLoadOptions.Filters property or ImGearSaveOptions.Filters property, and pass the Load or Save options object to the reading or writing method, correspondingly: