ImageGear .NET
Initializing Assemblies

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: ImageGear23.Formats.CameraRaw.dll

Supported Formats: Hasselblad RAWHeaderless Camera RawImacon RawKodakRAWLeicaRAW, MEF, MOS, MRW, NEF, ORF, PEF, PhaseOneRaw, RAF, SonyRaw

C#
Copy Code
using ImageGear.Core;
using ImageGear.Formats;
public void ApplicationStartupMethod()
{
     // License scope.

     // Initialize assemblies following the order recommended.
     ImGearCameraRawFormats.Initialize();
}
VB.NET
Copy Code
Imports ImageGear.Core
Imports ImageGear.Formats
Public Sub ApplicationStartupMethod()
            ' License scope.

            ' Initialize assemblies following the order recommended.
            ImGearCameraRawFormats.Initialize()
End Sub

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:

C#
Copy Code
IImGearFormat headerlessRawFormat =ImGearFileFormats.Filters.Get(ImGearFormats.HeaderlessRaw);
ImGearFileFormats.Filters.Remove(ImGearFormats.HeaderlessRaw);
ImGearFileFormats.Filters.Add(headerlessRawFormat);
VB.NET
Copy Code
Dim headerlessRawFormat As IImGearFormat = ImGearFileFormats.Filters.[Get](ImGearFormats.HeaderlessRaw)
ImGearFileFormats.Filters.Remove(ImGearFormats.HeaderlessRaw)
ImGearFileFormats.Filters.Add(headerlessRawFormat)

Common File Formats

Assembly: ImageGear23.Formats.Common.dll

Supported Formats: BMPCLPCURDCRAWDIBDNGGIFICO, JFIF, JPEGPNGRAWTIFF

C#
Copy Code
using ImageGear.Core;
using ImageGear.Formats;
public void ApplicationStartupMethod()
{
     // License scope.

     // Initialize assemblies following the order recommended.
     ImGearCommonFormats.Initialize();
}
VB.NET
Copy Code
Imports ImageGear.Core
Imports ImageGear.Formats
Public Sub ApplicationStartupMethod()
            ' License scope.

            ' Initialize assemblies following the order recommended.
            ImGearCommonFormats.Initialize()
End Sub

Advanced File Formats

Assembly: ImageGear23.Formats.Advanced.dll 

Supported Formats: BTRCAL, CR2, CRW, CUT, DCX, GEM, IFF, IMGIMR, IMTIOCA, KFX, LV, MODCA, MSP, NCR, PBMPCDPCXPGMPNMPPMPSB, PSDPTOCA, RAS, Scitex CT, SGI, TGA, WBMP, WPG, XBMXPMXWD

C#
Copy Code
using ImageGear.Core;
using ImageGear.Formats;
public void ApplicationStartupMethod()
{
     // License scope.

     // Initialize assemblies following the order recommended.
     ImGearAdvancedFormats.Initialize();
}
VB.NET
Copy Code
Imports ImageGear.Core
Imports ImageGear.Formats
Public Sub ApplicationStartupMethod()
            ' License scope.

            ' Initialize assemblies following the order recommended.
            ImGearAdvancedFormats.Initialize()
End Sub

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:

C#
Copy Code
IImGearFormat cutFormat =ImGearFileFormats.Filters.Get(ImGearFormats.CUT);
ImGearFileFormats.Filters.Remove(ImGearFormats.CUT);
ImGearFileFormats.Filters.Add(cutFormat);
VB.NET
Copy Code
Dim cutFormat As IImGearFormat = ImGearFileFormats.Filters.[Get](ImGearFormats.CUT)
ImGearFileFormats.Filters.Remove(ImGearFormats.CUT)
ImGearFileFormats.Filters.Add(cutFormat)

PDF and PS Formats

Assembly: ImageGear23.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.

C#
Copy Code
using ImageGear.Core;
using ImageGear.Formats;
using ImageGear.Formats.PDF;
public void ApplicationStartupMethod()
{
     // License scope.

     // Initialize assemblies following the order recommended.
     ImGearPDF.Initialize();
}

public void ApplicationEndPoint()
{
     // Terminate PDF Formats.
     ImGearPDF.Terminate();
}
VB.NET
Copy Code
Imports ImageGear.Core
Imports ImageGear.Formats
Public Sub ApplicationStartupMethod()
            ' License scope.

            ' Initialize assemblies following the order recommended.
            ImGearPDF.Initialize()
End Sub

Public Sub ApplicationEndPoint()
            ' Terminate PDF Formats.
            ImGearPDF.Terminate()
End Sub

Simplified Metadata

Assembly: ImageGear23.Formats.SimplifiedMetadata.dll

Supported Metadata Structures: EXIF Metadata StructureIPTC Metadata StructureTIFF Metadata StructureXMP Metadata Structure

C#
Copy Code
using ImageGear.Core;
using ImageGear.Formats;
public void ApplicationStartupMethod()
{
     // License scope.

     // Initialize assemblies following the order recommended.
     ImGearSimplifiedMetadata.Initialize();
}
VB.NET
Copy Code
Imports ImageGear.Core
Imports ImageGear.Formats
Public Sub ApplicationStartupMethod()
            ' License scope.

            ' Initialize assemblies following the order recommended.
            ImGearSimplifiedMetadata.Initialize()
End Sub

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: PDFPS

C#
Copy Code
using ImageGear.Core;
using ImageGear.Formats;
using ImageGear.Formats.PDF;
public void ApplicationStartupMethod()
{
     // License scope.

     // Initialize assemblies following the order recommended.
     // Require at least Common Formats.
     ImGearCommonFormats.Initialize();

     // Require PDF Formats.
     ImGearPDF.Initialize();

     // Add support for PDF and PS
     ImGearFileFormats.Filters.Add(ImGearPDF.CreatePDFFormat());
     ImGearFileFormats.Filters.Add(ImGearPDF.CreatePSFormat());
}
VB.NET
Copy Code
Imports ImageGear.Core
Imports ImageGear.Formats
Imports ImageGear.Formats.PDF
Public Sub ApplicationStartupMethod()
            ' License scope.

            ' Initialize assemblies following the order recommended.
            ' Require at least Common Formats.
            ImGearCommonFormats.Initialize()

            ' Require PDF Formats.
            ImGearPDF.Initialize()

            ' Add support for PDF and PS
            ImGearFileFormats.Filters.Add(ImGearPDF.CreatePDFFormat())
            ImGearFileFormats.Filters.Add(ImGearPDF.CreatePSFormat())

End Sub

CAD/Vector Formats

Namespaces:

ImageGear.Formats.CAD

ImageGear.Formats.CGM

ImageGear.Formats.DGN

ImageGear.Formats.DWF

ImageGear.Formats.HPGL

ImageGear.Formats.SVG

ImageGear.Formats.U3D

Supported Formats: CGMDGN, DWFDWG, DXFHPGLSVGU3D

C#
Copy Code
using ImageGear.Core;
using ImageGear.Formats;
using ImageGear.Formats.CAD;
using ImageGear.Formats.DWF;
using ImageGear.Formats.SVG;
public void ApplicationStartupMethod()
{
     // License scope.

     // Initialize assemblies following the order recommended.
     // Require at least Common Formats.
     ImGearCommonFormats.Initialize();

     // Add support for DWG, DWF and SVG.
     ImGearFileFormats.Filters.Add(ImGearCAD.CreateDWGFormat());
     ImGearFileFormats.Filters.Add(ImGearSVG.CreateSvgFormat());
     ImGearFileFormats.Filters.Add(ImGearDWF.CreateDWFFormat());
}
VB.NET
Copy Code
Imports ImageGear.Core
Imports ImageGear.Formats
Imports ImageGear.Formats.CAD
Imports ImageGear.Formats.DWF
Imports ImageGear.Formats.SVG
Public Sub ApplicationStartupMethod()
            ' License scope.

            ' Initialize assemblies following the order recommended.
            ' Require at least Common Formats.
            ImGearCommonFormats.Initialize()

            ' Add support for DWG, DWF and SVG.
            ImGearFileFormats.Filters.Add(ImGearCAD.CreateDWGFormat())
            ImGearFileFormats.Filters.Add(ImGearSVG.CreateSvgFormat())
            ImGearFileFormats.Filters.Add(ImGearDWF.CreateDWFFormat())

End Sub

Medical (DICOM)

Namespace: ImageGear.Formats.DICOM

Supported Formats: DICOM 

C#
Copy Code
using ImageGear.Core;
using ImageGear.Formats;
using ImageGear.Formats.DICOM;
public void ApplicationStartupMethod()
{
     // License scope.

     // Initialize assemblies following the order recommended.
     // Require at least Common Formats.
     ImGearCommonFormats.Initialize();

     // Add support for DICOM.
     ImGearFileFormats.Filters.Add(ImGearDICOM.CreateDICOMFormat());
}
VB.NET
Copy Code
Imports ImageGear.Core
Imports ImageGear.Formats
Imports ImageGear.Formats.DICOM
Public Sub ApplicationStartupMethod()
            ' License scope.

            ' Initialize assemblies following the order recommended.
            ' Require at least Common Formats.
            ImGearCommonFormats.Initialize()

            ' Add support for DICOM.
            ImGearFileFormats.Filters.Add(ImGearDICOM.CreateDICOMFormat())

End Sub

Extended JPEG and JPEG 2000

Namespace: ImageGear.Formats.JPEG2K

Supported Formats:  JPEGJPEG 2000 (Part-1 JP2, Part-2 JPX and Codestream J2K)

C#
Copy Code
using ImageGear.Core;
using ImageGear.Formats;
using ImageGear.Formats.JPEG2K;
public void ApplicationStartupMethod()
{
     // License scope

     // Initialize assemblies following the order recommended.
     // Require at least Common Formats
     ImGearCommonFormats.Initialize();

     // Replace native ImageGear JPEG filter with extended filter.
     ImGearFileFormats.Filters.Add(ImGearCommonFormats.CreateJpegFormat());

     // Add support for JP2 and JPX.
     ImGearFileFormats.Filters.Add(ImGearJPEG2K.CreateJP2Format());
     ImGearFileFormats.Filters.Add(ImGearJPEG2K.CreateJPXFormat());
}
VB.NET
Copy Code
Imports ImageGear.Core
Imports ImageGear.Formats
Imports ImageGear.Formats.JPEG2K
Public Sub ApplicationStartupMethod()
            ' License scope

            ' Initialize assemblies following the order recommended.
            ' Require at least Common Formats
            ImGearCommonFormats.Initialize()
                                   
            ' Replace native ImageGear JPEG filter with extended filter.
            ImGearFileFormats.Filters.Add(ImGearCommonFormats.CreateJpegFormat())

            ' Add support for JP2 and JPX.
            ImGearFileFormats.Filters.Add(ImGearJPEG2K.CreateJP2Format())
            ImGearFileFormats.Filters.Add(ImGearJPEG2K.CreateJPXFormat())

End Sub

Office

Namespace: ImageGear.Formats.Office

Supported Formats: DOCXPPTXXLSX

C#
Copy Code
using ImageGear.Core;
using ImageGear.Formats;
using ImageGear.Formats.Office;
public void ApplicationStartupMethod()
{
     // License scope.

     // Initialize assemblies following the order recommended.
     // Require at least Common Formats.
     ImGearCommonFormats.Initialize();

     // Add support for Office documents DOCX, PPTX and XLSX.
     ImGearFileFormats.Filters.Add(ImGearOffice.CreateWordFormat());
     ImGearFileFormats.Filters.Add(ImGearOffice.CreatePowerPointFormat());
     ImGearFileFormats.Filters.Add(ImGearOffice.CreateExcelFormat());
}
VB.NET
Copy Code
Imports ImageGear.Core
Imports ImageGear.Formats
Imports ImageGear.Formats.Office
Public Sub ApplicationStartupMethod()
            ' License scope.

            ' Initialize assemblies following the order recommended.
            ' Require at least Common Formats.
            ImGearCommonFormats.Initialize()

            ' Add support for Office documents DOCX, PPTX and XLSX.
            ImGearFileFormats.Filters.Add(ImGearOffice.CreateWordFormat())
            ImGearFileFormats.Filters.Add(ImGearOffice.CreatePowerPointFormat())
            ImGearFileFormats.Filters.Add(ImGearOffice.CreateExcelFormat())

End Sub

XPS

Assembly: ImageGear23.Wpf.dll

Namespace: ImageGear.WPF.XPS

Supported Formats: XPS

C#
Copy Code
using ImageGear.Core;
using ImageGear.Formats;
using ImageGear.WPF.XPS;
public void ApplicationStartupMethod()
{
     // License scope.

     // Initialize assemblies following the order recommended.
     // Require at least Common Formats.
     ImGearCommonFormats.Initialize();

     // Add support for XPS.
     ImGearFileFormats.Filters.Add(ImGearXPS.CreateXPSFormat());
}
VB.NET
Copy Code
Imports ImageGear.Core
Imports ImageGear.Formats
Imports ImageGear.Formats.XPS
Public Sub ApplicationStartupMethod()
            ' License scope.

            ' Initialize assemblies following the order recommended.
            ' Require at least Common Formats.
            ImGearCommonFormats.Initialize()

            ' Add support for XPS.
            ImGearFileFormats.Filters.Add(ImGearXPS.CreateXPSFormat())

End Sub

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 ImageGear23.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:

C#
Copy Code
IImGearFormat jpgFormat = ImGearFileFormats.Filters.Get(ImGearFormats.JPG);
ImGearControlParameter Param = jpgFormat.Parameters.GetByName("SaveType");
// Lossless.
Param.Value = 1;
VB.NET
Copy Code
Dim jpgFormat As IImGearFormat = ImGearFileFormats.Filters.[Get](ImGearFormats.JPG)
Dim Param As ImGearControlParameter = jpgFormat.Parameters.GetByName("SaveType")
' Lossless.
Param.Value = 1

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:

C#
Copy Code
ImGearFileFilters localFilters = new ImGearFileFilters();
IImGearFormat jpgFormat = localFilters.Get(ImGearFormats.JPG);
ImGearControlParameter controlParam = jpgFormat.Parameters.GetByName("SaveType");
// Lossless.
controlParam .Value = 1;
ImGearSaveOptions SaveOptions = new ImGearSaveOptions();
SaveOptions.Filters = localFilters;
VB.NET
Copy Code
Dim localFilters As New ImGearFileFilters()
Dim jpgFormat As IImGearFormat = localFilters.[Get](ImGearFormats.JPG)
Dim controlParam As ImGearControlParameter = jpgFormat.Parameters.GetByName("SaveType")
' Lossless.
controlParam.Value = 1
Dim SaveOptions As New ImGearSaveOptions()
SaveOptions.Filters = localFilters

 

 


©2017. Accusoft Corporation. All Rights Reserved.

Send Feedback