# Dumping image

**URL:** <https://discourse.itk.org/t/dumping-image/5138>\
**Category:** Beginner Questions\
**Created:** [June 28, 2022, 3:33pm UTC](https://discourse.itk.org/t/dumping-image/5138 "2022-06-28T15:33:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Florian\_Bouillet](https://discourse.itk.org/letter_avatar_proxy/v4/letter/f/6bbea6/32.png) [@Florian\_Bouillet](https://discourse.itk.org/u/Florian_Bouillet)\
**Post date:** [June 28, 2022, 3:33pm UTC](https://discourse.itk.org/t/dumping-image/5138/1 "2022-06-28T15:33:48Z")

</div>

Hello,

is there a way to dump an image in an ostream& instead of directly to a file with itkImageFileWriter ?

Best regards,  
Florian Bouillet

---

<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:** [June 28, 2022, 4:36pm UTC](https://discourse.itk.org/t/dumping-image/5138/2 "2022-06-28T16:36:49Z")

</div>

I don’t think so. `ImageFileWriter` is designed for writing to files. And it delegates this duty to different other libraries, usually one for each of the supported file formats.

Some of those libraries do have an ability to write to an open `ostream&`. But you will have to write extra code and probably also directly link to the library in question.

---

<div class="post-metadata">

**Author:** ![Lee\_Newberg](https://discourse.itk.org/user_avatar/discourse.itk.org/lee_newberg/32/1461_2.png) [@Lee\_Newberg](https://discourse.itk.org/u/Lee_Newberg)\
**Post date:** [June 28, 2022, 4:43pm UTC](https://discourse.itk.org/t/dumping-image/5138/3 "2022-06-28T16:43:36Z")

</div>

There are a number of ways to make standard output look like a file that are described at [linux - pass stdout as file name for command line util? - Stack Overflow](https://stackoverflow.com/questions/7756609/pass-stdout-as-file-name-for-command-line-util).

---

<div class="post-metadata">

**Author:** ![Florian\_Bouillet](https://discourse.itk.org/letter_avatar_proxy/v4/letter/f/6bbea6/32.png) [@Florian\_Bouillet](https://discourse.itk.org/u/Florian_Bouillet)\
**Post date:** [June 30, 2022, 8:49am UTC](https://discourse.itk.org/t/dumping-image/5138/4 "2022-06-30T08:49:38Z")

</div>

Ok thanks a lot
