# Writing and reading .tif metadata

**URL:** https://discourse.itk.org/t/writing-and-reading-tif-metadata/7419
**Category:** Beginner Questions
**Created:** [February 4, 2025, 5:45pm UTC](https://discourse.itk.org/t/writing-and-reading-tif-metadata/7419 "2025-02-04T17:45:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![rhysgt](https://discourse.itk.org/user_avatar/discourse.itk.org/rhysgt/32/4455_2.png) [@rhysgt](https://discourse.itk.org/u/rhysgt)
#### Post date: [February 4, 2025, 5:45pm UTC](https://discourse.itk.org/t/writing-and-reading-tif-metadata/7419/1 "2025-02-04T17:45:06Z")

</div>

I am reading an image with imread:

`out_image = itk.imread(files[0], itk.UC)`

then changing adding metadata tags:

```auto
out_image['TileWidth'] = str(int(size[0]))
out_image['Date_start'] = other_image['Date']

```

When I run `print(dict[image])`, I see all the metadata. However, when I write out the image and read it in again and the metadata is not stored with the image.

```auto
itk.imwrite(out_image, str(out_file))
new_im = itk.imread(str(out_file), itk.UC)
print(dict(new_im))

```

What am I doing wrong please?

---

<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: [February 4, 2025, 5:54pm UTC](https://discourse.itk.org/t/writing-and-reading-tif-metadata/7419/2 "2025-02-04T17:54:16Z")

</div>

If you put the image through any processing, that typically removes the metadata. What file format are you writing?

---

<div class="post-metadata">

### Author: ![rhysgt](https://discourse.itk.org/user_avatar/discourse.itk.org/rhysgt/32/4455_2.png) [@rhysgt](https://discourse.itk.org/u/rhysgt)
#### Post date: [February 4, 2025, 6:15pm UTC](https://discourse.itk.org/t/writing-and-reading-tif-metadata/7419/3 "2025-02-04T18:15:52Z")

</div>

I add the metadata in just before writing. I am writing to a .tif file.
