Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Clarification on obtaining image orientation and aspect ratio in Sanity.io

2 replies
Last updated: Jul 22, 2020
Aspect ratio is available under
metadata.dimensions.aspectRatio

Orientation is not available, but you should be able to calculate that from width and height under
metdata.dimensions.width
and
metdata.dimensions.height

Se
https://www.sanity.io/docs/image-type#example-of-a-image-asset-object-with-metadata-location-lqip-palette-and-dimensions-df3f768ce073 for a full list of metadata
Jul 22, 2020, 8:43 AM
Aspect ratio is available under
metadata.dimensions.aspectRatio

Orientation is not available, but you should be able to calculate that from width and height under
metdata.dimensions.width
and
metdata.dimensions.height

Se
https://www.sanity.io/docs/image-type#example-of-a-image-asset-object-with-metadata-location-lqip-palette-and-dimensions-df3f768ce073 for a full list of metadata
Jul 22, 2020, 8:43 AM
Great that you figured it out! Not great that the docs are not clear. There is a feedback widget at the bottom of every docs article, so if you can leave it at the article you feel was most lacking / confusing that would be excellent! Thank you!
Jul 22, 2020, 4:53 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?