开发者

Image size considering (or not) h/v resolution

开发者 https://www.devze.com 2023-04-11 21:35 出处:网络
I have two images: NameTypeWidthHeightHResVRes img01GIF25625638496 img02TIFF17281147200100 Windows internal viewer shows them using different patterns:

I have two images:

Name   Type  Width  Height  HRes  VRes  
img01  GIF   256    256     384   96  
img02  TIFF  1728   1147    200   100

Windows internal viewer shows them using different patterns:

  • img01 is displayed as 256x256 image (square)
  • img02 is displayed as a vertical image (despite of width>height) and image format is correct

After seen img02 behaviour I thought that displayed size is given by:

Display_Width  = max(HRes,VRes) * Width / HRes
Display_Height = max(HRes,VRes) * Height / VRes

But that's not good for img01, which is displayed as 256x256!!

If I use Image class to load those images, resolution is not taken in account, so img02 is shown horizontally and distorced respect correct format.

If Windows internal viewer shows them correctly, I think there should be some property to understand if resolution should be considered or开发者_高级运维 not.

With Image class I have Flags and PropertyItems properties, but I really don't understand if they are the ones I have to look at.

Can you teach me the right method to display images (using Image class) without distortion?

Thanks


Aspect ratio in GIF files is very uncommon, since GIF is a format used to store graphics intended to be displayed on computer screens. In fact, GIF87a files do not have an aspect ratio at all, and GIF89a do not store the actual aspect ratio but an approximation.

On the other side, TIFF files for the most part are used by graphic designers, photographers and publishers, so the concept of pixel aspect ratio is core to the format as it allows these files to move between different display mediums.

My guess is that most GIF decoders ignore the aspect ratio from the GIF89a format. I think you should do the same.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号