androidfresco

Fresco: How to get original bitmap size?


I am loading images using Fresco, how can I get the original bitmap size?

This is what I been trying so far

ImageRequest request = ImageRequestBuilder
    .newBuilderWithSource(uri)
    .setImageDecodeOptions(ImageDecodeOptions.newBuilder()
    .setBackgroundColor(Color.GREEN)
    .build())
    .setPostprocessor(new BasePostprocessor() {

        @Override
        public void process(Bitmap bitmap) {
            super.process(bitmap);
            width = bitmap.getWidth();
            height = bitmap.getHeight();
        }

        @Override
        public void process(Bitmap destBitmap, Bitmap sourceBitmap) {
            super.process(destBitmap, sourceBitmap);
        }
    }).build();

But some how it feels that I am not getting the original size there.


Solution

  • Use ControllerListener as explained in the documentation.