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.