Predict the output
Roughly how much memory does a fully decoded 4000 × 3000 ARGB_8888 bitmap use?
fun main() {
val bytes = 4_000L * 3_000L * 4L
println("${bytes / 1_000_000} MB")
}Hint 1 of 1
How many bytes per pixel in ARGB_8888?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A 48 MB
Correct. Width × height × 4 bytes per pixel.
Why not the others?
- B 3 MB, about the JPEG size. The file is compressed; decoded pixels aren't.
- C 12 MB. Each ARGB_8888 pixel takes 4 bytes, not 1.
- D 480 MB. Off by a factor of ten.