[Android] Crash when displaying large images (Pixel 8 Pro, Android 15) — Canvas: trying to draw too large bitmap
- Dominant language
- Go
- Stars
- 9.2k
- Forks
- 1.3k
- Avg merge
- 12h 58m
- Merged PRs (30d)
- 56
Description
**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
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the crash from any chat through Camera > Photo from library with a 6144x8160 Pixel 50MP image. Trace where the selected image is loaded before rendering; done means the image is downscaled before Android Canvas draws it and the app no longer crashes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, react-native
- Domain
- mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100