---
title: "captureToImage"
description: "Captures the underlying semantics node's surface into bitmap. This can be used to capture nodes
in a normal composable, a dialog if API >=28 and in a Popup. Note that the mechanism used to
capture the bitmap from a Popup is not the same as from a normal composable, since a PopUp is in
a different window."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-android'>Android</div>


```kotlin
@RequiresApi(Build.VERSION_CODES.O)
fun SemanticsNodeInteraction.captureToImage(): ImageBitmap
```


Captures the underlying semantics node's surface into bitmap. This can be used to capture nodes
in a normal composable, a dialog if API >=28 and in a Popup. Note that the mechanism used to
capture the bitmap from a Popup is not the same as from a normal composable, since a PopUp is in
a different window.



