Skip to content

Instantly share code, notes, and snippets.

@aspose-com-gists
Created June 9, 2025 21:25
Show Gist options
  • Save aspose-com-gists/eabfd08ea280a201d339e597fa246142 to your computer and use it in GitHub Desktop.
Save aspose-com-gists/eabfd08ea280a201d339e597fa246142 to your computer and use it in GitHub Desktop.
SVG Image Resizer
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