SVG to BMP Conversion with the Java API

Aspose.HTML for Java converts SVG files and content to BMP with Converter.convertSVG() . Load the source into SVGDocument, select ImageFormat.Bmp in ImageSaveOptions, and provide the output path. The renderer processes vector shapes, text, styles, and referenced resources before creating the bitmap.


Create a BMP Image from SVG

The example opens document.svg, selects BMP output, and saves the rasterized result as output.bmp. Try-with-resources releases the SVG document automatically.

Convert SVG to BMP in Java

import com.aspose.html.converters.Converter;
import com.aspose.html.dom.svg.SVGDocument;
import com.aspose.html.rendering.image.ImageFormat;
import com.aspose.html.saving.ImageSaveOptions;

// Load the SVG document
try (SVGDocument document = new SVGDocument("document.svg")) {
    // Select BMP output
    ImageSaveOptions options = new ImageSaveOptions(ImageFormat.Bmp);

    // Convert SVG to BMP
    Converter.convertSVG(document, options, "output.bmp");
}

Preview SVG to BMP Conversion Online

Upload an SVG file or provide its URL to inspect the BMP result before implementing the conversion in a Java application.

SVG to BMP API Workflow

  1. Add Aspose.HTML for Java to the project.
  2. Load the source with SVGDocument .
  3. Create ImageSaveOptions with ImageFormat.Bmp.
  4. Call Converter.convertSVG() with the document, options, and output path.

Set BMP Size and Raster Resolution

ImageSaveOptions controls output resolution, page dimensions, margins, background color, smoothing, CSS processing, and text rendering. BMP normally requires more storage than compressed image formats. Use SVG to PNG when lossless raster output and smaller files are required.

See Convert SVG to JPG in Java for the shared image workflow and the ImageSaveOptions API Reference .


Install Aspose.HTML for Java

Add Aspose.HTML for Java from the official Aspose repository. Replace ASPOSE_HTML_VERSION with an exact version from the Aspose.HTML for Java releases page, then reload or rebuild the project so the dependency is resolved.

Add the repository and dependency to the Maven project:

Maven – pom.xml

<repositories>
    <repository>
        <id>AsposeJavaAPI</id>
        <url>https://releases.aspose.com/java/repo/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>com.aspose</groupId>
        <artifactId>aspose-html</artifactId>
        <version>ASPOSE_HTML_VERSION</version>
    </dependency>
</dependencies>

Add the repository and dependency to the Gradle project:

Gradle – build.gradle

repositories {
    maven {
        url = uri('https://releases.aspose.com/java/repo/')
    }
}
dependencies {
    implementation 'com.aspose:aspose-html:ASPOSE_HTML_VERSION'
}

Use a JDK compatible with the selected release. For manual JAR installation, Kotlin DSL, updates, and dependency troubleshooting, see Install Aspose.HTML for Java .


SVG to BMP Conversion FAQ

1. Does SVG to BMP preserve vector scalability?

No. BMP is a raster format with fixed pixel dimensions. Enlarging the result after conversion can expose pixelation that is not present in the original vector graphic.

2. Why is a BMP file created from SVG comparatively large?

BMP commonly stores raster data with little or no compression, so it normally requires more space than PNG, GIF, or JPG output.

3. Can I control the raster dimensions of the BMP image?

Yes. Configure page size, margins, and horizontal and vertical resolution through ImageSaveOptions before calling Converter.convertSVG().

4. Can I convert SVG to BMP online for free?

Yes. Use the free online SVG to BMP converter for a manual conversion. Use Aspose.HTML for Java for automated processing.

Related Java Conversions

Choose another SVG output or a related HTML rendering workflow.