imagesize icon indicating copy to clipboard operation
imagesize copied to clipboard

Pixel aspect support?

Open virtualritz opened this issue 1 year ago • 5 comments

It would be great if the crate also returned a num-rational::Ratio pixel_aspect for image formats that support this.

This would just be 1:1 for any image format that doesn't, or if absent.

virtualritz avatar Jun 06 '24 19:06 virtualritz

I'm not entirely opposed to potentially getting this info, but I want to try to not rely on any external creates, sans dev dependencies.

Is there a flow that would require this information? How would you anticipate it fitting into the current library? Curious about how you'd want it to work.

Roughsketch avatar Jun 08 '24 01:06 Roughsketch

When you want to call an external tool to resize an image, e.g. for a preview, it is often preferable to make sure the latter has a pixel aspect of 1:1.

Particularly OpenEXRs that were converted from CinemaDNGs shot with anamorphic lenses will often have 1:1.33 or 1:2 pixel aspects and need non-linear scaling to display correctly.

virtualritz avatar Jun 08 '24 10:06 virtualritz

How would you want it integrated into the library? My first thought would be a pixel_size method that returns a new struct called PixelSize which seems simple enough.

Also if you happen to know which file types support different pixel sizes please let me know.

Roughsketch avatar Jun 08 '24 13:06 Roughsketch

Yes, that sounds good. But it would be pixel_aspect which is short for pixel aspect ratio which is what literature and industry have settled on, as a term for this, since decades.

virtualritz avatar Jun 09 '24 09:06 virtualritz

I also suggest to put this behind a feature flag. 😁

virtualritz avatar Jun 09 '24 12:06 virtualritz