Four common reasons Sanity's image hotspot fails and how to fix each
Developers using Sanity's image-url builder often find that hotspot and crop focal points set in Studio are ignored during rendering. The most frequent cause is the builder defaulting to fit('clip') instead of fit('crop'), which must be explicitly set for hotspot data to take effect. A second issue arises when content migrated from other systems stores hotspot coordinates as pixel values rather than the required 0–1 fractional values, causing the CDN to misplace the crop. Sanity stores hotspot as x, y, width, and height floats between 0 and 1, and any value above 1 signals a faulty import that requires a migration script to normalise. Developers can verify hotspot behaviour by inspecting raw documents in Sanity Studio or checking generated image URLs for the crop query parameter.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in