How to Resize SVG Image in Java

In this brief tutorial, you will learn how to resize SVG image in Java. It provides detailed steps, a runnable sample code along with the environment configuration steps. You can resize SVG in Java with the help of a few API calls and may customize the output SVG as well.

Steps to Resize an SVG Image in Java

  1. Setup your application to use Aspose.Imaging from the repository
  2. Load the source SVG file into the Image class object that is to be resized in Java
  3. Call the Image.resize() method with new size and resize type as CenterToCenter
  4. Save the output SVG that is resized as per the requirements

These steps are designed to change size of SVG image in Java. The configuration details and sequence of programming steps are shared that can be followed in any of the environments supporting Java. You may also customize the resized SVG image before saving it on the disk.

Code to Resize SVG File in Java

You may use SvgOptions class object in the Image.Save() function to customize the resized SVG by calling one or more methods like setColorType(), setCompress(), setTextAsShapes(). Similarly, you may use ISvgResourceKeeperCallback getCallback() to get or set the font store options,

In this quick tutorial we have learned to increase size of SVG image in Java. If you want to change the image size of other types, refer to the article on how to resize image using Java.

 English