'How can I access the .tif metadata that is seen in ImageJ, but in Python?

I load a .tif file from a microscopy experiment into ImageJ, and it tells me the dimensions of the field of view of the microscope (424.27x424.27 microns). To access this in ImageJ, I go to the Image tab, then 'show info', and then scroll to the bottom to find this data:microscopy metadata in imageJ

How can I access this data in python? My aim is to show microscopy data in python, which I have already done, but I want to have the x and y axes of the figure going up to 424.27 microns.

Thanks!



Solution 1:[1]

I think the data may be related to the tiff tag x_resolution and y_resolution. See the link for more details about some baseline tiff tags: https://www.awaresystems.be/imaging/tiff/tifftags/baseline.html

tifffile may be helpful. Install and import it, I think the code sample on its website is what you want.

with TiffFile('temp.tif') as tif:
...     tag = tif.pages[0].tags['XResolution']

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Joe_Bao