Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bitmap.compressToInternal() not working #540

Open
phileo opened this issue Oct 4, 2023 · 0 comments
Open

Bitmap.compressToInternal() not working #540

phileo opened this issue Oct 4, 2023 · 0 comments

Comments

@phileo
Copy link

phileo commented Oct 4, 2023

I am trying to capture map rendering as a Bitmap using the following code snippet:

com.carto.ui.MapView.mapRenderer.captureRendering(object : RendererCaptureListener() {
            override fun onMapRendered(bitmap: com.carto.graphics.Bitmap) {
                super.onMapRendered(bitmap)
                val bitmapFile = File(context.applicationContext.filesDir, "bitmap.bmp")
                ByteArrayInputStream(bitmap.compressToPNG().data).copyToFile(bitmapFile)
            }

        }, true)

The above code snippet works and provides a PNG file.

However, if I replace compressToPNG() with compressToInternal(), then the above capture fails and the resulting file cannot be opened.

Any ideas as to why compressToInternal() is not working?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant