How to obtain an image size using the ImageDecoder?

时间:2019-01-18 18:52:06

标签: android size bitmapfactory imagedecoder

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.

0 个答案:

没有答案