Convert XML to jpg


is there any way to convert a given XML to jpg/png? I would like to implement this in java. Look forward for your response

If the process was deployed to the engine, there is an image resource already present in the system. The following code will get the latest version of “lamdaProcess” and write it to a file called “processImage.png”:

ProcessDefinition process = repositoryService.createProcessDefinitionQuery().processDefinitionKey("lamdaProcess").latestVersion().singleResult();
InputStream stream = repositoryService.getResourceAsStream(process.getDeploymentId(), process.getDiagramResourceName());

File targetFile = new File("processImage.png");

try {
} catch (IOException e) {
1 Like

Hey, dont get me wrong. I have an existing XML from floawable and i try to convert this to jpeg/png.
Are there any classes implemented?

My point was just that, if it is already in flowable there is no reason to convert manually. If you need to convert arbitrary input to an image, there are several places in the code where we generate process diagrams. For instance then a new process is deployed, the engine uses the ProcessDefinitionDiagramHelper which you could probably also use. You could also look at the modeler’s code and how its ModelImageService calls out to various DiagramGenerator’s to create thumbnails. In both cases the process gets parsed first before being sent to the Diagram Generators.

Unfortunately I don’t have any simple code examples for you to convert arbitrary XML to a diagram, but perhaps the references in the source will give you a push in the right direction.

Thanks I still working on that problem. I have the XML File and try to convert to an Image. Do you have any further hints for me?

This could probably be a lot more efficient, it’s currently standing up the entire process engine just to create an image. But for a quick and dirty implementation, it will work:

Hey, thanks for your reply. I found all classes to create an image from model_editor_json object. Is there any way to convert a given bpmn XML to that format (model_editor_json). Looking foward to your response.