How to obtain an image size using Android's ImageDecoder class?
Asked Answered
P

0

9

Trying to get an image size using the ImageDecoder I can't find any option to get only the size without decoding the image bitmap.

With BitmapFactory can be done with:

BitmapFactory.Options.inJustDecodeBounds = true

This setting makes the decoder to obtain only the image size without having to decode and return a bitmap. But the ImageDecoder has no equivalent option.

In addition, the size seems to be known only when ImageDecoder.OnHeaderDecodedListener gets called, and neither at this point there is any option to cancel the decoding and avoid returning the bitmap.

Plectognath answered 18/1, 2019 at 18:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.