Created
January 20, 2021 07:52
-
-
Save GroupDocsGists/6bfdc6033f28598a78631ccadf843c3c to your computer and use it in GitHub Desktop.
Convert WebP to JPG, PNG, GIF, TIFF, or PDF in Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert WebP to JPG in Java using GroupDocs.Conversion API | |
Converter converter = new Converter("filePath/WebPImage.webp"); | |
ImageConvertOptions options = new ImageConvertOptions(); | |
options.setFormat(ImageFileType.Jpg); | |
converter.convert("path/WebPToJPG.jpg", options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert WebP to PDF in Java using GroupDocs.Conversion API | |
Converter converter = new Converter("filePath/WebPImage.webp"); | |
PdfConvertOptions options = new PdfConvertOptions(); | |
converter.convert("filePath/WebPToPDF.pdf", options); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Convert WebP to JPG, PNG, GIF, TIFF in Java and apply filters like Flip, Brightness, Contrast, Gamma, Rotate, Watermark | |
Converter converter = new Converter("filePath/WebPImage.webp"); | |
// Set Image Conversion Options. You can apply one filter at a time. | |
ImageConvertOptions options = new ImageConvertOptions(); | |
options.setFormat(ImageFileType.Jpg); | |
options.setFlipMode(ImageFlipModes.FlipX); | |
options.setBrightness(50); | |
options.setContrast(50); | |
options.setGamma(0.5F); | |
options.setGrayscale(true); | |
options.setRotateAngle(90); | |
// Set Watermark Text and Appearance | |
WatermarkOptions watermark = new WatermarkOptions(); | |
watermark.setText("GroupDocs"); | |
watermark.setFont(new Font("Arial", Font.BOLD, 130)); | |
watermark.setColor(Color.WHITE); | |
watermark.setBackground(false); | |
watermark.setRotationAngle(-45); | |
watermark.setTop(70); | |
watermark.setLeft(150); | |
watermark.setTransparency(0.2); | |
options.setWatermark(watermark); | |
converter.convert("filePath/WebPToJPG.jpg", options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment