Skip to content

[Android] Crash when displaying large images (Pixel 8 Pro, Android 15) — Canvas: trying to draw too large bitmap #28352

Open

Description

@rajtsic

Describe the bug
When trying to send or view a high-resolution image (6144x8160 pixels, taken with Pixel 8 Pro 50MP camera) in a chat, Keybase crashes with the error:
java.lang.RuntimeException: Canvas: trying to draw too large(200540160bytes) bitmap.

The image is around 7.6MB on disk (JPEG), but when Android tries to draw it, it uses ~200MB RAM because of the pixel dimensions.
The crash happens immediately after adding the photo.

To Reproduce
Steps to reproduce the behavior:
Go to any chat
Click on Camera button > Photo from library > pick a Pixel 50MP picture (6144x8160)
Add it to the chat
App crashes on load

Expected behavior
The app should properly downscale large images before rendering them, to prevent Canvas from crashing.

Additional numbers
The number 345567

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions