# Convert XML to jpg

**URL:** <https://forum.flowable.org/t/convert-xml-to-jpg/4503>\
**Category:** Flowable Engine\
**Created:** [September 11, 2019, 7:36am UTC](https://forum.flowable.org/t/convert-xml-to-jpg/4503 "2019-09-11T07:36:31Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![wwitt](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/wwitt/32/706_2.png) [@wwitt](https://forum.flowable.org/u/wwitt)\
**Post date:** [September 11, 2019, 1:51pm UTC](https://forum.flowable.org/t/convert-xml-to-jpg/4503/2 "2019-09-11T13:51:55Z")

</div>

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”:

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

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

try {
    java.nio.file.Files.copy(
            stream,
            targetFile.toPath(),
            StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
    e.printStackTrace();
}

```

---

_[View the full topic](https://forum.flowable.org/t/convert-xml-to-jpg/4503)._
