2012.01.09 01:53 "[Tiff] resolution issue when converting jpeg to tiff", by Jingfei Hu

2012.01.09 01:53 "[Tiff] resolution issue when converting jpeg to tiff", by Jingfei Hu

Hi, everyone.

I've posted this question on www.stackoverflow.com, but got no proper answer. So I decide to put this question here.

Now I have some files whose suffix is .tif. However, I can't open it with libtiff(Tiff for Windows 3.8.2). It says bad magic number (0xd8ff). So I know these files aren't actually tiff files, they are jpeg files.

Then, I use libjpeg library to read these files. I need to convert these jpeg files into tiff files. I get the x-resolution and y-resolution using libexif(because libjpeg doesn't support this), says 72 dpi, and I use TIFFSetField to set the corresponding field of the tiff to be generated with no error occurred. But the x-resolution is 96dpi when I look up the property of the generated tiff using Windows Property(Right click on the tiff ->Property).

When I use the utility of libtiff, tiffinfo.exe, to look the information of generated tiff files, it returns (0,0) pixels/inch.

When I open this generated tiff files with Photoshop CS5, it says 72 dpi in image size dialog (opened with Ctrl+Alt+I).

I just doesn't know the reason. Is there a method to set the resolution so that tiffinfo could recognize the resolution correctly.

Hope make myself clear

Cheers,

Jfhu