Let'S Convert Svg to Bmp in Java

Overview

Converting SVG to BMP in Java is a crucial task for many developers. Aspose.HTML for Java plays a significant role in this process. Meanwhile, it is widely used across various industries. Furthermore, Aspose.HTML for Java simplifies the conversion process. Additionally, it provides a robust solution for Java developers.

Image Conversion SDK Installation

To get started with Aspose.HTML for Java, download the library or install it using the following dependency:

<repository>
  <id>AsposeJavaAPI</id>
  <name>Aspose Java API</name>
  <url>https://repository.aspose.com/repo/</url>
</repository>
<dependency>
  <groupId>com.aspose</groupId>
  <artifactId>aspose-html</artifactId>
  <version>24.5</version>
</dependency>

Notably, Aspose.HTML for Java offers ease of integration, flexibility, and advanced customization options.

Let’S Convert SVG to BMP in Java - Code Snippet

To convert SVG to BMP in Java, follow these steps:

  1. Create an instance of the SVGDocument class and load the source SVG.
  2. Create an object of the ImageSaveOptions class and define the target image file format(i.e. BMP).
  3. The convertSVG method of the Converter class will convert SVG to BMP.

The following code sample implements the vector to raster conversion programmatically:

public class main {
// Convert SVG to BMP in Java
public static void main(String[] args) {
// Define the working directory.
String dataDir = "/files/";
// Create an object of the SVGDocument with the source SVG file.
SVGDocument document = new SVGDocument(dataDir+"input.svg");
try {
// Create an object of the ImageSaveOptions class and define the target image file format(i.e. BMP).
ImageSaveOptions options = new ImageSaveOptions(
ImageFormat.Bmp
);
// The convertSVG method of the Converter class will convert SVG to BMP.
Converter.convertSVG(
document,
options,
dataDir+"output.bmp"
);
} finally {
if (document != null) {
document.dispose();
}
}
}
}
view raw SVG-to-BMP.java hosted with ❤ by GitHub
You can see the output in the image below:
svg-to-bmp

Get a Free License

Get a free trial for Aspose products by visiting this link.

SVG to BMP Converter - Try Online

Try this online SVG to BMP converter powered by Aspose.HTML for Java. It’s free, easy to use, and accurate.

svg-to-bmp-converter

Conclusion

In conclusion, this guide demonstrated the functionality of how to convert SVG to BMP in Java using Aspose.HTML for Java. Therefore, try Aspose.HTML for Java to automate this conversion by opting for this image conversion SDK.

Public Resources

Additional resources, such as documentation or community forums, can help enhance your understanding of Aspose.HTML for Java.

Explore