plantuml

Referencing local image in PlantUML salt wireframe


I'm trying to include a local image into my PlantUML salt wireframe for my GUI documentation in Ubuntu 20.04. The PlantUMl reference page only shows how to include a http link. How to do this?

I tried the following, but I'm getting "Cannot decode" in the output.

@startsalt
scale 2
{

title Test Page
{S

{^"Figure"
<img:file://./pie-chart.png>
<img:file://./pie-chart.png>
<img:.\pie-chart.png>
}
..

}

}
@endsalt

Solution

  • If you store the image blah.png at the same location as the PlantUML source, this will work:

    @startsalt
    scale 2
    {
    
    title Test Page
    {S
    
    {^"Figure"
    <img:blah.png>
    }
    ..
    
    }
    
    }
    @endsalt
    

    I get on my (windows) machine:

    enter image description here

    Edit: WSL (Ubuntu) test

    I have WSL on my Windows machine, and so I started up VSCode in Ubuntu, and installed the PlantUML plugin for VSCode. I created a file /home/me/test/blah.png (copied from my Windows), and then created the following PlantUML file stored in /home/me/test.wsd:

    @startsalt
    'scale 1
    {
    
    title Test Page
    {S
    
    {^"Figure 0"
    <img:test/blah.png>
    }
    {^"Figure 1"
    <img:./test/blah.png>
    }
    {^"Figure 2"
    <img:"/home/me/test/blah.png">
    }
    {^"Figure 3"
    <img src="/home/me/test/blah.png">
    }
    {^"Figure 4"
    <img src="test/blah.png">
    }
    ..
    
    }
    
    }
    @endsalt
    

    Ubuntu (WSL) rendering

    It has relative and absolute paths, with the src= alternative for specifying images. I can get them all to work with png files on my Ubuntu 20 (again, using the PlantUML extension for VSCode). I should state that I have it configured to use the PlantUML server. If you're using an older version of PlantUML (Ubuntu's apt will sadly bring over an ancient one).