title: How to export canvas to Png image and save it to gallery in jetpack compose?
body: <p>I created an application for image editing. I create some effected-on images from the gallery but can't save them after editing them.</p>
  <p>This is an example of a canvas that I want to save as png.</p>
  <pre><code>    var resizedBitmap: Bitmap? = null
      Canvas(modifier = Modifier.fillMaxSize(0.75f)) {
          val canvasWidth = size.width
          val canvasHeight = size.height
          with(painter) {
              draw(painter.intrinsicSize)
          }
          drawRect(black, size = size.copy(width = size.width / 2))
          drawRect(
              white,
              size = size.copy(width = size.width / 2),
              topLeft = Offset(x = size.width / 2F, y = 0F),
          )
          resizedBitmap = Bitmap.createScaledBitmap(
              bitmap, (canvasWidth * 0.8).toInt(),
              (canvasHeight * 0.8).toInt(), true
          )
          drawImage(
              image = resizedBitmap!!.asImageBitmap(),
              dstOffset = IntOffset(
                  x = (canvasWidth / 2).toInt() - (resizedBitmap!!.width / 2),
                  y = (canvasHeight / 2).toInt() - (resizedBitmap!!.height / 2),
              ),
  
              )
  
      }
  </code></pre>