Image Effect Creator Licensing Plugin

Contents
[ ]

         Unlock an extensive range of image and photo effects and apply various filters to enhance your images and adjust image parameters with the Image Effect Creator Licensing Plugin. With this license plugin, you can smooth images using filters such as GaussWiener, BilateralSmoothing, MotionWeiner, GaussianBlur, and MedianFilter. Additionally, you can adjust image brightness, contrast, and color gamma, as well as apply dithering, binarization, and grayscale effects. The C# example below demonstrates the application of popular filters and effects to images from the supported file formats list using the RasterImage class. Before applying the filters, ensure you obtain a Metered license by providing your public key and private password using the `SetMeteredKey()` method.

using Aspose.Imaging;
using Aspose.Imaging.Dithering;
using Aspose.Imaging.ImageFilters.FilterOptions;
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
string dataDir = templatesFolder;
Run3();
//------------------------------------------------------------------------------
// Image effect plug-in license use examples
//------------------------------------------------------------------------------
void Run3()
{
// Valid image effect license use example
Metered license = new Metered();
// Only metered plug-in license is supported
license.SetMeteredKey("<your public key>", "<your private key>");
string OutputDirectory = templatesFolder;
if (!Directory.Exists(OutputDirectory))
{
Directory.CreateDirectory(OutputDirectory);
}
string inputFileName = Path.Combine(templatesFolder, "template.png");
ApplyFilter(inputFileName, Path.Combine(OutputDirectory, "licensed_gauss_effect.png"),
new GaussWienerFilterOptions(13, 2)
{
Brightness = 1,
}
);
ApplyFilter(inputFileName, Path.Combine(OutputDirectory, "licensed_bilateral_smoothing.png"),
new BilateralSmoothingFilterOptions());
ApplyFilter(inputFileName, Path.Combine(OutputDirectory, "licensed_gauss_wiener.png"),
new GaussWienerFilterOptions(5, 1.5)
{
Brightness = 1,
Snr = 0.003
}
);
ApplyFilter(inputFileName, Path.Combine(OutputDirectory, "licensed_motion_wiener.png"),
new MotionWienerFilterOptions(10, 1, 0)
{
Brightness = 1,
Snr = 0.007
}
);
ApplyFilter(Path.Combine(templatesFolder, "template.png"), Path.Combine(OutputDirectory, "licensed_gauss_blur.png"),
new GaussianBlurFilterOptions(5, 4));
ApplyFilter(inputFileName, Path.Combine(OutputDirectory, "licensed_gauss_wienere_grayscale.png"),
new GaussWienerFilterOptions(6, 3) { Grayscale = true }
);
ApplyFilter(inputFileName, Path.Combine(OutputDirectory, "licensed_median_effect.png"),
new MedianFilterOptions(4)
);
ApplyImageEffect(inputFileName, Path.Combine(OutputDirectory, "licensed_dithering.png"), doDithering);
ApplyImageEffect(inputFileName, Path.Combine(OutputDirectory, "licensed_binarization.png"), doBinarizeBradley);
ApplyImageEffect(inputFileName, Path.Combine(OutputDirectory, "licensed_grayscale.png"), doGrayscale);
ApplyImageEffect(inputFileName, Path.Combine(OutputDirectory, "licensed_brightness_change.png"), doBrightness);
ApplyImageEffect(inputFileName, Path.Combine(OutputDirectory, "licensed_contrast_change.png"), doContrast);
ApplyImageEffect(inputFileName, Path.Combine(OutputDirectory, "licensed_gamma_change.png"), doGamma);
}
/// <summary>
/// Applies the filter.
/// </summary>
/// <param name="inputFileName">The input file name.</param>
/// <param name="outputFileName">The output file name.</param>
/// <param name="options">The options.</param>
void ApplyFilter(string inputFileName, string outputFileName, FilterOptionsBase options)
{
string inputFilePath = inputFileName;
string outputFilePath = outputFileName;
using (Image image = Image.Load(inputFilePath))
{
RasterImage rasterImage = image as RasterImage;
if (rasterImage == null)
{
return;
}
rasterImage.Filter(image.Bounds, options);
image.Save(outputFilePath);
}
}
void ApplyImageEffect(string inputFileName, string outputFileName, Func<Image, Image> doEffect = null)
{
using (var image = (RasterImage)Image.Load(inputFileName))
{
Image outImage = doEffect(image);
outImage.Save(outputFileName);
}
}
Image doDithering(Image image)
{
var raster = image as RasterImage;
if (raster == null)
{
return null;
}
DitheringMode dithering = new DitheringMode();
dithering.Bits = 1;
dithering.Method = DitheringMethod.ThresholdDithering;
raster.Dither(dithering.Method, dithering.Bits);
return raster;
}
/// <summary>
/// Binarization test.
/// </summary>
Image doBinarizeBradley(Image image)
{
RasterImage rasterImage = image as RasterImage;
if (rasterImage == null)
{
throw new Exception("Image should be the raster image");
}
int threshold = -2;
if (threshold != -1 && threshold != -2)
{
byte b = (byte)threshold;
rasterImage.BinarizeFixed(b);
}
else if (threshold == -2)
{
rasterImage.BinarizeBradley(threshold);
}
else
{
rasterImage.BinarizeOtsu();
}
return rasterImage;
}
/// <summary>
/// Grayscale test.
/// </summary>
Image doGrayscale(Image image)
{
RasterImage rasterImage = image as RasterImage;
if (rasterImage == null)
{
throw new Exception("Image should be the raster image");
}
rasterImage.Grayscale();
return rasterImage;
}
/// <summary>
/// Brightness test.
/// </summary>
Image doBrightness(Image image)
{
RasterImage rasterImage = image as RasterImage;
if (rasterImage == null)
{
throw new Exception("Image should be the raster image");
}
int brightness = 70;
rasterImage.AdjustBrightness(brightness);
return rasterImage;
}
/// <summary>
/// Contrast test.
/// </summary>
Image doContrast(Image image)
{
RasterImage rasterImage = image as RasterImage;
if (rasterImage == null)
{
throw new Exception("Image should be the raster image");
}
int contrast = 80;
rasterImage.AdjustContrast(contrast);
return rasterImage;
}
/// <summary>
/// Gamma test.
/// </summary>
Image doGamma(Image image)
{
RasterImage rasterImage = image as RasterImage;
if (rasterImage == null)
{
throw new Exception("Image should be the raster image");
}
float gamma1 = 3;
rasterImage.AdjustGamma(gamma1);
return rasterImage;
}

Explore the variety of features and capabilities of image effects offered by our Aspose.Imaging Photo Filter free online application website.