Embedding images (bitmap or svg) in diagrams

0 votes
asked Sep 6, 2015 in Wanted features by anonymous
Is there a way to embed an image inside a note in activity diagrams? Sometimes I want to associate a small photo to a particular component. Or even use images as the nodes in the activity diagrams.

 

I noticed that URLs were available inside notes. Perhaps those URLS could be turned into embedded images.

2 Answers

+1 vote
answered Sep 6, 2015 by plantuml (134,650 points)
edited Sep 6, 2015 by plantuml

Hi,

Using creole engine (see http://plantuml.com/creole.html ), you can have:

start
:foo;
note left
 You can use images
<img:http://plantuml.com/logoc.png>
end note
stop

Is this what you are looking for ?

commented Sep 6, 2015 by anonymous
Awesome! So this must allow data uris right? And potentially it could be combined with include directives to embed the image into the file as well?
commented Sep 6, 2015 by plantuml (134,650 points)
If you are refering to https://en.wikipedia.org/wiki/Data_URI_scheme the answer is not yet.
You are suggesting that the following example should work, right ?

start
:foo;
note left
 You can use images
<img:data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
9TXL0Y4OHwAAAABJRU5ErkJggg==>
end note
stop

The closest thing which is working today is sprite ( http://plantuml.com/sprite.html ) but this is not exactly what you are looking for.
commented Sep 7, 2015 by anonymous
Would this work with includes? Considering that I may not want to write the base64 inline, but I want the output to have the image embedded?
commented Sep 7, 2015 by plantuml (134,650 points)
Yes, it works with includes
+1 vote
answered Sep 6, 2015 by plantuml (134,650 points)

In the last beta https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

You can have:

@startuml
start
:foo;
note left
 You can use images <img:data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==>
end note
stop
@enduml

Note that base64 has to be on a single line. We will try to add the hability to have data on several lines.

Thanks for the suggestion!

commented Jun 2 by anonymous
How do you specify a scaling or size of the image? Is that doable?
commented Jun 2 by plantuml (134,650 points)
You can specify a scale, like in the following examples:

@startuml
start
:foo;
note left
 You can use images
<img:http://plantuml.com/logoc.png{scale=2}>
end note
stop
@enduml

@startuml
start
:foo;
note left
 You can use images <img:data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=={scale=3}>
end note
stop
@enduml

Is this what you are looking for ?
commented Jun 3 by anonymous
Thanks this is exactly what I was looking for.

Is there a page that lists all these attributes that can be included? For example I'm also looking to center the image.
...