Image Resizer Licensing Plugin

Contents
[ ]

         Effortlessly resize images while maintaining control over resolution and quality with the Image Resizer license plugin. Before beginning, obtain a Metered license by providing your public and private keys using the `setMeteredKey()` method. Import your image in a compatible format from the list of supported file formats, then utilize the resize() method to adjust the image dimensions according to your preferences. Finally, save the resized image. Keep in mind that utilizing an unlicensed feature of the Aspose.Imaging graphic library will result in a watermark being applied to the output image.

import com.aspose.imaging.Image;
import com.aspose.imaging.Metered;
import com.aspose.imaging.RasterImage;
import com.aspose.imaging.RotateFlipType;
import com.aspose.imaging.imageoptions.JpegOptions;
import java.io.File;
//------------------------------------------------------------------------------
// Resize plug-in license use examples
//------------------------------------------------------------------------------
// Valid resize license use example
Metered license = new Metered();
// Only metered plug-in license is supported
license.setMeteredKey("<your public key>", "<your private key>");
// get path of the input data
String templatesFolder = System.getenv("DATA_PATH");
if (templatesFolder == null)
{
templatesFolder = "c:\\Users\\USER\\Downloads\\templates\\";
}
// get output path
String outputFolder = System.getenv("OUT_PATH");
if (outputFolder == null)
{
outputFolder = templatesFolder;
}
try (RasterImage image = (RasterImage) Image.load(templatesFolder + "template.png"))
{
String filePath = outputFolder + "licensed_tiger0.jpg";
image.resize(image.getWidth() << 1, image.getHeight() << 1);
image.save(filePath, new JpegOptions());
new File(filePath).delete();
}
// Unlicensed use of flip rotate with resize license
try (RasterImage image = (RasterImage) Image.load(templatesFolder + "template.png"))
{
String filePath = outputFolder + "trial_tiger0.jpg";
image.rotateFlip(RotateFlipType.Rotate180FlipXY);
image.save(filePath, new JpegOptions());
new File(filePath).delete();
}

Discover the features and capabilities of our free online Aspose.Imaging Resize Application website.