User Guide > How to Work with... > Loading and Saving Pages and Documents > Use 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:
The following example sets a global control parameter:
C# |
Copy Code |
---|---|
IImGearFormat JpgFormat = ImGearFileFormats.Filters.Get(ImGearFormats.JPG); ImGearControlParameter Param = JpgFormat.Parameters.GetByName("SaveType"); Param.Value = 1; // Lossless using (FileStream fsWrite = File.Open("Test.jpg", FileMode.Create, FileAccess.ReadWrite, FileShare.None)) ImGearFileFormats.SavePage(imGearPage, fsWrite, 0, ImGearSavingModes.OVERWRITE, ImGearSavingFormats.JPG, null); |
The following example sets a local control parameter:
C# |
Copy Code |
---|---|
ImGearFileFilters LocalFilters = new ImGearFileFilters(); IImGearFormat JpgFormat = LocalFilters.Get(ImGearFormats.JPG); ImGearControlParameter Param = JpgFormat.Parameters.GetByName("SaveType"); Param.Value = 1; // Lossless ImGearSaveOptions SaveOptions = new ImGearSaveOptions(); SaveOptions.Filters = LocalFilters; using (FileStream fsWrite = File.Open("Test.jpg", FileMode.Create, FileAccess.ReadWrite, FileShare.None)) ImGearFileFormats.SavePage(imGearPage, fsWrite, 0, ImGearSavingModes.OVERWRITE, ImGearSavingFormats.JPG, SaveOptions); |