Created
June 9, 2025 21:25
-
-
Save aspose-com-gists/eabfd08ea280a201d339e597fa246142 to your computer and use it in GitHub Desktop.
SVG Image Resizer
This file contains hidden or 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
package com.example; | |
import com.aspose.imaging.Image; | |
import com.aspose.imaging.fileformats.svg.SvgImage; | |
import com.aspose.imaging.imageoptions.PngOptions; | |
import com.aspose.imaging.imageoptions.SvgRasterizationOptions; | |
public class main | |
{ | |
public static void main(String[] args) | |
{ | |
// The path to the documents directory. | |
String dataDir = "data"; | |
// Load the source SVG image by calling the Image.load method. | |
try (SvgImage image = (SvgImage) Image.load(dataDir + "test.svg")) | |
{ | |
// The resize method will resize the SVG image. | |
image.resize(image.getWidth() * 2, image.getHeight() * 2); | |
// Save the resized image by calling the save method. | |
image.save(dataDir + "Logotype_10_15_out.png", new PngOptions() | |
{{ | |
setVectorRasterizationOptions(new SvgRasterizationOptions()); | |
}}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment