| 1 |
+++ |
| 2 |
title = "TIFF" |
| 3 |
weight = 10 |
| 4 |
+++ |
| 5 |
|
| 6 |
## TIFF data format |
| 7 |
|
| 8 |
Before loading the main binary data, BornAgain reads the following metadata tags from `tiff` file: |
| 9 |
|
| 10 |
* [ImageWidth](https://www.awaresystems.be/imaging/tiff/tifftags/imagewidth.html) |
| 11 |
* [ImageLength](https://www.awaresystems.be/imaging/tiff/tifftags/imagelength.html) |
| 12 |
* [BitsPerSample](https://www.awaresystems.be/imaging/tiff/tifftags/bitspersample.html) |
| 13 |
* [SamplesPerPixel](https://www.awaresystems.be/imaging/tiff/tifftags/samplesperpixel.html) |
| 14 |
* [SampleFormat](https://www.awaresystems.be/imaging/tiff/tifftags/sampleformat.html) |
| 15 |
|
| 16 |
`ImageWidth` and `ImageLength` are mandatory; the other three tags |
| 17 |
are optional and fall back to their TIFF-spec defaults (1) if absent. |
| 18 |
|
| 19 |
The required values of the tags are the following: |
| 20 |
|
| 21 |
* `BitsPerSample` should be 8, 16 or 32. |
| 22 |
* `SamplesPerPixel` should be 1, which means grayscale image with one channel, corresponding to signal intensity. |
| 23 |
* `SampleFormat` should be 1, 2 (integer numbers) or 3 (floating-point numbers). `SampleFormat==3` requires value of `BitsPerSample==32`. |
| 24 |
|
| 25 |
### Checking tags |
| 26 |
|
| 27 |
File tags can be checked by external utilites. |
| 28 |
|
| 29 |
In Linux there are `tiffinfo` from `libtiff` |
| 30 |
```bash |
| 31 |
$ tiffinfo file.tiff |
| 32 |
``` |
| 33 |
|
| 34 |
or `identify` from `imagemagic` |
| 35 |
```bash |
| 36 |
$ identify -verbose file.tiff |
| 37 |
``` |
| 38 |
|
| 39 |
In Windows [AsTiffTagViewer](https://www.awaresystems.be/imaging/tiff/astifftagviewer.html) can be used. |
| 40 |
|
| 41 |
Alternatively, online services can show metadata tags. |
| 42 |
|
| 43 |
### Unsupported tiff formats |
| 44 |
|
| 45 |
If there is a case of `tiff` data file that is not yet supported, please contact us and provide the example. |