@mica/sdk (SDK contract v1)
    Preparing search index...

    Function computeThumbnailSize

    • The thumbnail's pixel size — the photo's own aspect, longest edge capped.

      Aspect kept, not cropped square. The grid tile is aspect-square and MediaThumb draws with object-cover, so CSS crops it for free and — this is the point — crops it identically to the way it already crops a row that has no thumbnail and falls back to data. Cropping here would make those two paths look different, in a gallery that will hold both for as long as anyone's old photos survive. It also keeps the thumbnail honest for the surfaces that are not square (the camera's own recent-capture tile, a message attachment, a full-view placeholder), and it is cheaper: a 16:9 photo at 320 on the long edge is 320x180, against 320x320 for a square crop.

      Never upscales, for the same reason computeCropGeometry does not (MICA-77): the phone often renders smaller than this ceiling, and stretching a small capture up is interpolation blur that costs bytes to store. A source already under the cap is re-encoded at thumbnail quality at its own size, which still shrinks it several times over.

      Parameters

      • naturalWidth: number
      • naturalHeight: number

      Returns { height: number; width: number } | null