ImageGear for Java User Guide > Using ImageGear for Java > Loading/Saving Pages and Documents > Using Filter Control Parameters |
Many format filters in ImageGear have control parameters that effect 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:
Example |
Copy Code |
---|---|
IImGearFormat JpgFormat = ImGearFileFormats.getFilters().Get(ImGearFormats.JPG); ImGearControlParameter Param = JpgFormat.getParameters().GetByName("SaveType"); Param.setValue(0); // Lossy ImGearFileStream output = null; try { output = new ImGearFileStream("lossy.jpg", "rw"); ImGearFileFormats.SavePage(igPage, output, 0, ImGearSavingModes.OVERWRITE, ImGearSavingFormats.JPG); } finally { output.close(); } |
The following example sets a local control parameter:
Example |
Copy Code |
---|---|
ImGearFileFilters localFilters = new ImGearFileFilters(); IImGearFormat JpgFormat = localFilters.Get(ImGearFormats.JPG); ImGearControlParameter Param = JpgFormat.getParameters().GetByName("SaveType"); Param.setValue(0); // Lossy ImGearFileStream output = null; ImGearSaveOptions SaveOptions = new ImGearSaveOptions(); SaveOptions.setFilters(localFilters); try { output = new ImGearFileStream("lossyLocal.jpg", "rw"); ImGearFileFormats.SavePage(igPage, output, 0, ImGearSavingModes.OVERWRITE, ImGearSavingFormats.JPG, SaveOptions); } finally { output.close(); } |