# How to return PNG as an array instead of writing to file

**URL:** <https://discourse.itk.org/t/how-to-return-png-as-an-array-instead-of-writing-to-file/3013>\
**Category:** Uncategorized\
**Created:** [April 27, 2020, 7:29pm UTC](https://discourse.itk.org/t/how-to-return-png-as-an-array-instead-of-writing-to-file/3013 "2020-04-27T19:29:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henco](https://discourse.itk.org/letter_avatar_proxy/v4/letter/h/cab0a1/32.png) [@Henco](https://discourse.itk.org/u/Henco)\
**Post date:** [April 27, 2020, 7:29pm UTC](https://discourse.itk.org/t/how-to-return-png-as-an-array-instead-of-writing-to-file/3013/1 "2020-04-27T19:29:21Z")

</div>

Hi,

I’m trying to use ITK in conjunction with Unity. Currently, when my program is called from Unity, it reads a .mha + .raw 3D image file, applies two filters, and outputs a 2D PNG, which is written to another folder where Unity can make use of it. What I would like to do is circumvent having to write a PNG file that is immediately loaded back in. I am able to call my ITK program as a function in Unity, so I was hoping there was a way to return the PNG as an array instead of writing a file. [This link from the mailing list](https://cmake.org/pipermail/insight-users/2005-September/014741.html) is the closest I got to answering my question on my own, but the link to “Getting Started V: Integrating ITK in your Application” is dead.

---

<div class="post-metadata">

**Author:** ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)\
**Post date:** [April 28, 2020, 5:25pm UTC](https://discourse.itk.org/t/how-to-return-png-as-an-array-instead-of-writing-to-file/3013/2 "2020-04-28T17:25:25Z")

</div>

You could look into [FileFree ImageIO](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/IO/ImageBase/test/itkFileFreeImageIO.h).

I think an [updated link](https://itk.org/ITK/help/tutorials.html) redirects here:

> **[Courses in Image Analysis that use ITK - Kitware Blog](https://blog.kitware.com/courses-in-medical-image-analysis-that-use-itk/)**
>
> Post last updated: October 24th, 2019. The Insight Toolkit (ITK) is not only a foundation for the practice of image analysis in industry and academia; ... Read More
