Files
AndroidJetpack/telephoto/docs/zoomableimage/sub-sampling.md
T
coco 723ce1af5c a
2026-07-03 15:12:48 +08:00

959 B

Sub-sampling

type:video

For displaying large images that may not fit into memory, ZoomableImage automatically divides them into tiles so that they can be loaded lazily.

If ZoomableImage ^^can't^^ be used or if sub-sampling of images is always desired, you could potentially use SubSamplingImage() directly.

implementation("me.saket.telephoto:sub-sampling-image:{{ versions.telephoto }}")
val zoomableState = rememberZoomableState()
val imageState = rememberSubSamplingImageState(
  zoomableState = zoomableState,
  imageSource = SubSamplingImageSource.asset("fox.jpg")
)

SubSamplingImage(
  modifier = Modifier
    .fillMaxSize()
    .zoomable(zoomableState),
  state = imageState,
  contentDescription = ,
)

SubSamplingImage() is an adaptation of the excellent subsampling-scale-image-view by Dave Morrissey.