DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk5 min

How to Convert UML Diagram Code to an Image

Convert diagram code by matching it to its renderer: PlantUML CLI or Server for PlantUML, and Mermaid CLI for Mermaid. Compare output formats and troubleshoot common failures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

First identify the diagram language in your source file: PlantUML and Mermaid use different renderers. For PlantUML, run the PlantUML command-line tool to create a PNG by default, or select SVG or another supported format. For Mermaid, use Mermaid CLI to export the definition as SVG, PNG, or PDF.

Identify the diagram language first

Check the source file and its syntax before choosing a converter. PlantUML source is rendered by PlantUML; Mermaid definitions need Mermaid CLI. They are not interchangeable, and neither tool is a universal converter for every kind of UML code.

As an Amazon Associate I earn from qualifying purchases.

  • Use PlantUML if the source is written in PlantUML syntax, commonly saved with a .puml extension.
  • Use Mermaid CLI for a Mermaid definition, commonly saved as .mmd.
  • If the file uses another diagram language, find a renderer for that language rather than assuming either tool will parse it.

Convert PlantUML code with the local command line

With Java and the PlantUML JAR available, open a terminal in the directory containing the diagram and run:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
java -jar plantuml.jar diagram.puml

PlantUML creates a PNG by default. Replace diagram.puml with your source filename. The basic command can also process multiple files, for example:

java -jar plantuml.jar file1 file2 file3

PlantUML documents processing files and directories; the exact installation steps depend on how you obtained the JAR or packaged build, so make sure the command points to the correct file.

Choose SVG or another output format

To request SVG, use the documented output option:

java -jar plantuml.jar --svg diagram.puml

The CLI also supports -f svg and documents PDF and other output formats. Confirm that the particular diagram type supports the format you want: not every PlantUML diagram can be rendered as SVG. If SVG is unavailable for that type, try PNG.

Control source metadata in PNG files

PlantUML PNG output can contain encoded source metadata. Use -nometadata to disable embedding it. The CLI also provides -metadata to extract metadata from a local PNG.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Render PlantUML through PlantUML Server

If you do not want to run the local CLI, PlantUML Server accepts encoded diagram source in a URL. Its documented route patterns are:

/plantuml/png/ENCODED
/plantuml/svg/ENCODED

Use the PNG route for a raster image or the SVG route for a vector image, subject to the diagram type’s format support. The source must be encoded in the form expected by the server; a raw PlantUML text file cannot simply be appended unchanged to the route.

The server documentation also describes deploying PlantUML Server on your own Java web server. The current documentation specifies Tomcat 10 because of the transition from javax.* to jakarta.*; check the requirements for the specific version you plan to install. The documentation describes the interface and deployment, but does not establish a hosted service’s source-retention or privacy terms. For control over where source is processed, prefer a local renderer or a server you operate.

Convert Mermaid diagram code with Mermaid CLI

For Mermaid source, use Mermaid CLI rather than PlantUML. Given an input file named input.mmd, the documented SVG command is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
mmdc -i input.mmd -o output.svg

Mermaid CLI can also generate PNG or PDF by setting the output filename extension accordingly:

mmdc -i input.mmd -o output.png
mmdc -i input.mmd -o output.pdf

The project README documents installation through npm, with Docker and Podman instructions as alternatives. Follow the installation method appropriate to your environment, then run the command from the location of the input file or provide its path. This workflow applies to Mermaid definitions, not arbitrary PlantUML or other UML source.

Choose PNG, SVG, or PDF

Format Use it when Important qualification
PNG You need a raster image that works in a wide range of viewers, or your diagram type does not support SVG. PlantUML’s default output is PNG.
SVG You need a vector image that scales cleanly for many web and documentation uses. PlantUML and Mermaid CLI document SVG output, but PlantUML does not support SVG for every diagram type.
PDF You need an output suited to a document or print workflow. Both PlantUML CLI and Mermaid CLI document PDF output.

Use the format option or output extension documented by the renderer you chose. An unsuccessful render can indicate a syntax problem or that the requested format is unsupported for the diagram type; the format documentation does not establish one universal error message or fix.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot a failed conversion

  • The command cannot find the JAR or input file: run the command from the directory containing the files, or use their full paths. Check that the JAR filename matches the one on your system.
  • The output is not the format you expected: PlantUML produces PNG by default. Select SVG or another documented format explicitly; Mermaid CLI uses the output filename extension.
  • PlantUML SVG output does not work for a diagram: that diagram type may not support SVG. Try PNG instead.
  • The CLI rejects the source: confirm that you selected the renderer for the source language and check the diagram syntax. PlantUML and Mermaid are distinct formats.
  • You need to render without sending source to a hosted service: use the local CLI, or deploy a server you operate. The hosted server documentation cited here does not establish data-retention terms.

Or skip the browser setup

If your goal is to capture a rendered diagram in a browser, ScreenshotNeo is a website screenshot API and MCP server; it captures a URL as PNG, JPEG, WebP, or PDF. It does not convert raw PlantUML or Mermaid source by itself: render the diagram to a page first, then capture that page.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a simple capture, create an API key and use this cURL request. The response is saved as a WebP image; see the ScreenshotNeo API documentation for output and capture options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; those steps can be turned off. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Official documentation

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.