Page 1 of 1

How to write pixel size in metadata

PostPosted: Wed Aug 12, 2015 12:22 pm
by JohannesL
Hello,
I have a relatively simple question for which I could not find an answer on the ImageJ listserv or the Bioformats forum.

After taking an image, how can I add the correct metadata on pixel size in order to have it read properly by ImageJ/Bioformats? It does not seem to be enough to change “Exif.Image.XResolution” and “Exif.Image.YResolution”.

I would like to do this for jpg and for tiff.
The background is that I made a small program to remote control the DSLR on a microscope. Since for each objective, pixel size changes, I have to add the actual dimensions accordingly.

Thanks in advance for help.
Johannes

Re: How to write pixel size in metadata

PostPosted: Tue Aug 18, 2015 2:20 am
by mlinkert
Hi Johannes,

After taking an image, how can I add the correct metadata on pixel size in order to have it read properly by ImageJ/Bioformats? It does not seem to be enough to change “Exif.Image.XResolution” and “Exif.Image.YResolution”.

I would like to do this for jpg and for tiff.


For TIFF, setting tags 282 and 283 (X and Y resolution, see http://www.awaresystems.be/imaging/tiff ... ution.html) is sufficient. You will need to set these tags in the first IFD though, not in a separate EXIF IFD.

Bio-Formats doesn't currently set the physical pixel sizes for JPEG files, but we can add that in 5.1.4 (see https://trello.com/c/bTLXSRkH/45-set-ph ... jpeg-files). If you set either tags 282 and 283 or tags 37390 and 37391 (plus unit tags as appropriate, see http://www.exiv2.org/tags.html), that should be supported in future releases.

Regards,
-Melissa