ImageGear assemblies require explicit initialization at application startup.
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.
Assembly: ImageGear24.Formats.CameraRaw.dll
Supported Formats: Hasselblad RAW, Headerless Camera Raw, 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 disabled by default. If you enable detection of these formats, 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:
Assembly: ImageGear24.Formats.Common.dll
Supported Formats: BMP, CLP, CUR, DCRAW, DIB, DNG, 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.
C# |
Copy Code |
---|---|
using ImageGear.Core; using ImageGear.Formats; public void ApplicationStartupMethod() { // License scope. // Initialize filter list with default set of common file formats. ImGearCommonFormats.Initialize(); // Replace default (managed) JPEG and PNG file formats with native implementation. ImGearFileFormats.Filters.Set(ImGearCommonFormats.CreateJpegFormat()); ImGearFileFormats.Filters.Set(ImGearCommonFormats.CreatePngFormat()); } |
Assembly: ImageGear24.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:
Assembly: ImageGear24.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, see PDF and PS in the "Additional Support" section, below.
Assembly: ImageGear24.Formats.SimplifiedMetadata.dll
Supported Metadata Structures: EXIF Metadata Structure, IPTC Metadata Structure, TIFF Metadata Structure, XMP Metadata Structure
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.
Namespace: ImageGear.Formats.PDF
Namespaces:
Supported Formats: CGM, DGN, DWF, DWG, DXF, HPGL, SVG, U3D
Namespace: ImageGear.Formats.DICOM
Supported Formats: DICOM
Namespace: ImageGear.Formats.JPEG2K
Supported Formats: JPEG, JPEG 2000 (Part-1 JP2, Part-2 JPX and Codestream J2K)
Namespace: ImageGear.Formats.Office
Supported Formats: DOCX, DOC, PPTX, PPT, XLSX, XLS
Assembly: ImageGear24.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 ImageGear24.Wpf.dll.
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:
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:
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: