Image Converter Licensing Plugin
Swiftly convert images from one file format to another using the Image Converter license plugin and our extensive list of supported formats. Before starting the conversion process, make sure to obtain a Metered license by providing your public and private keys through the `setMeteredKey()` method. Then, load your image file, such as in PNG format, using the `load()` method, and proceed to save it in JPEG format using the `save()` method along with the JpegOptions() object parameter. Failure to use a licensed feature of the Aspose.Imaging graphic library will result in a watermark being added to the resulting image.
import com.aspose.imaging.Image; | |
import com.aspose.imaging.Metered; | |
import com.aspose.imaging.imageoptions.JpegOptions; | |
import java.io.File; | |
//------------------------------------------------------------------------ | |
// Conversion plug-in use sample | |
//------------------------------------------------------------------------ | |
// Conversion plug-in licensed 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 (Image image = Image.load(templatesFolder + "template.png")) | |
{ | |
String filePath = outputFolder + "licensed_tiger0.jpg"; | |
image.save(filePath, new JpegOptions()); | |
new File(filePath).delete(); | |
} | |
// Unlicensed use of resize with conversion license | |
try (Image image = Image.load(templatesFolder + "template.png")) | |
{ | |
String filePath = outputFolder + "trial_tiger0.jpg"; | |
image.resize(image.getWidth() << 1, image.getHeight() << 1); | |
image.save(filePath, new JpegOptions()); | |
new File(filePath).delete(); | |
} |
Discover the capabilities of our free online conversion application demo by visiting our Aspose.Imaging Conversion Application website directly.