mingrammer / diagrams

:art: Diagram as Code for prototyping cloud system architectures
https://diagrams.mingrammer.com
MIT License
39.42k stars 2.54k forks source link

Reduce whitespace in images #600

Open chris92109 opened 3 years ago

chris92109 commented 3 years ago

Hi

I was not able to find an answer to this question; hence, I am creating this "issue". I would like to know if there is a possibility to reduce the whitespace around the actual diagram/image.

For example, the attached diagram contains many whitespaces. The green border is the actual size of the image. The black one what I would like to crop the image to directly use it in documentations. landing_zone_services

Thank you for your support.

Best regards, Christian

clayms commented 3 years ago

@chris92109

Try changing the size and margin attributes in the graph_attr dictionary.

https://graphviz.org/docs/attrs/size/ https://graphviz.org/docs/attrs/margin/

See the following issue comment: https://github.com/mingrammer/diagrams/issues/459#issuecomment-774560588

cypriani commented 1 month ago

The proper answer is actually this one: https://github.com/mingrammer/diagrams/issues/459#issuecomment-1371344692 (i.e. to set pad to zero). This should be documented in Diagrams’ documentation IMHO.