Free Text to Diagram Converter API to Convert Text Diagrams to Images

0 Comments
Editor Ratings:
User Ratings:
[Total: 0   Average: 0/5]




Kroki is a free text to diagram converter API to convert text diagrams to images. With this API, you make requests to an endpoint with text diagram data and it returns an image. The image can be PNG or SVG and then you can use that anywhere you like. This service supports some popular diagram tools such as GraphViz, Mermaid, PlantUML, SvgBob, UMLet, and some others. There are different endpoints available where you can make the request and then get the image. And the best part is that, this services is self hosted as well. You can easily host it on a VPS or on any online server.

There are some graphs and diagrams maker websites that you can use for the same. But if you need an API to do this from your web and mobile applications then Kroki is a very good option. You just give it the graph in text form and it will make the diagram from it which you can get using tools like cURL, HTTP, etc. There are no heavy dependencies are needed to install this. You can easily install it from its binary releases or using Docker. It can even work on local server and you can use it on a LAN in your office or home.

Text to Diagram Converter API to Convert Text Diagrams to Images

Using this Free Text to Diagram Converter API to Convert Text Diagrams to Images:

Currently, there is an online demonstration version is available where you can make requests and get response in SVG. The SVG is a vector graphics format and you can use that anywhere you like. To make API calls, you don’t need API keys or any key id etc. You just make calls and get the response, Simple as that.

To make API calls, you can use command line tools like cURL, HTTP. For this, post, I will use cURL. So if you have this installed on your PC then you just start making calls. Or, you can install cURL for your platform from here.

Now, open terminal and make requests in the following syntax. Make the API calls in this way, it will immediately return the response in SVG. You can save that in a file and then open that in browser.

Syntax: curl https://demo.kroki.io/graphviz/svg --data-raw "Text Diagram"

Example: curl https://demo.kroki.io/graphviz/svg --data-raw "digraph G {Hello->World}"

kroki curl in action

There is another method to use this API as well. You can specify the text graph data as base64 format. But for that, you will need to use some client libraries. Convert the text to base64 and then specify that in the API request and get the response. You can see more examples of this to learn more about it.

Syntax: curl https://demo.kroki.io/blockdiag/svg/Base64Text

Example: curl https://demo.kroki.io/blockdiag/svg/eNpdxxxxxxxxxxxxxxxxxxxxxsuytGhiL_ZhQIU=

kroki curl in action with base 64

In this way, you can use this simple text to diagram API to easily convert text diagrams to images. And the method of doing that is very simple. If you go for the self hosting option, then there will be nothing different in the syntax of making the request to the endpoint.

Closing thoughts

Converting text diagrams using an API seemed pretty amazing and I liked the way it does it. There are a lot of examples for this are available that you will like. Different endpoints are available for creating charts, activity diagram, network diagram, block diagram, UML diagram, and some others. You can see the syntax for different type of text diagrams on its documentation page and then use them.

Editor Ratings:
User Ratings:
[Total: 0   Average: 0/5]