Please provide commands to import PNG and SVG images from jar files

+1 vote
asked Jan 7, 2016 in Closed feature request by anonymous
Currently we can define  external sprites (image from the filesystem) or internal sprites (textual representation).

Please provide also commands to import PNG and SVG images from jar files.

As an example, syntax could be something like

sprite foo1 jar:icons/archimate/business-process-16.png

1 Answer

0 votes
answered Oct 11, 2016 by Serge Wenger Work (15,620 points)
selected Jul 8, 2018 by Anthony-Gaudino
 
Best answer

You can import available sprites from the PlantUML STDLIB (http://plantuml.com/stdlib).
 


You can import available Archmate sprites (http://plantuml.com/archimate), sprite could be read from embedded png file:

sprite $aService jar:archimate/application-service

You can also import from your filesystem:

@startuml
sprite foo1 sprite1.png
Alice->Bob : hello <$foo1> there
@enduml

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

You can have:

@startuml
sprite foo1 some_file.jar~sprite1.png
Alice->Bob : hello <$foo1> there
@enduml

Where ~ delimits the file name (could be zip or jar) and the entry name in the zip/jar file.
This has not been highly tested...

You can also import SVGs:

sprite foo1 some_file.zip~sprite1.svg
sprite foo2 sprite2.svg
commented Nov 3, 2016 by Serge Wenger Work (15,620 points)
Thank you.
It works.
commented Dec 6, 2020 by Marius

Hi, I noticed that scaling of svg sprites won't work (but it does work for png/jpg files).

E.g.:

sprite foo2 sprite2.svg
rectangle "<$foo2{scale=0.2}>"

The surrounding rectangle gets scaled down, but the sprite still has the original size.

commented Dec 7, 2020 by Serge Wenger Work (15,620 points)
Hello,
Please create a new message for this problem. Otherwise it will be never be trated by PlantUML team.
commented Dec 14, 2020 by The-Lu (63,920 points)

Hello,

For traceability: See https://forum.plantuml.net/12623/scaling-of-svg-sprites-does-not-work created by Marius.

Thanks,
Th.

...