fresco icon indicating copy to clipboard operation
fresco copied to clipboard

java.lang.IllegalArgumentException: Requested size is too big

Open mrleolink opened this issue 11 years ago • 1 comments

Fresco can't not load this very big picture: https://cloud.githubusercontent.com/assets/4621928/6416784/0ee589a2-bea9-11e4-9604-f49b4071c2cc.JPG

And throws this exception:

07-09 15:16:21.096  19539-19564/com.facebook.samples.demo V/unknown:BufferedDiskCache﹕ Successful read from disk cache for https://cloud.githubusercontent.com/assets/4621928/6416784/0ee589a2-bea9-11e4-9604-f49b4071c2cc.JPG
07-09 15:16:21.106  19539-19563/com.facebook.samples.demo V/unknown:NativeMemoryChunkPool﹕ release (free) (object, size) = (42bdba18, 10044022)
07-09 15:16:21.106  19539-19563/com.facebook.samples.demo V/unknown:NativeMemoryChunkPool﹕ Used = (0, 0); Free = (0, 0)
07-09 15:16:21.116  19539-19539/com.facebook.samples.demo V/unknown:AbstractDraweeController﹕ controller 42c08ae0 0: final_failed @ onFailure: failure: java.lang.IllegalArgumentException: Requested size is too big
07-09 15:22:24.816  19539-19545/com.facebook.samples.demo D/dalvikvm﹕ GC_FOR_ALLOC freed 381K, 3% free 17074K/17484K, paused 8ms, total 9ms

Then I tried to resize the image with this code and it worked:

    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
            .setResizeOptions(new ResizeOptions(500, 500))
            .build();
    PipelineDraweeController controller = (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
            .setOldController(mBaselineJpegView.getController())
            .setImageRequest(request)
            .build();
    mBaselineJpegView.setController(controller);

So I came to a conclusion that Fresco doesn't take care of actual view's size (I'm not so sure though) even when fresco:actualImageScaleType is set.

Could you guys confirm this behavior and how could I make Fresco take care of it and start loading image after the view is laid out. Thanks!

mrleolink avatar Jul 09 '15 06:07 mrleolink

That is correct. Fresco at the moment doesn't take into account the view size automatically, but we are working on it. For now you need to manually specify the resize options. The difficulty is that the image request gets built before the layout happens. We are investigating ways of dynamically passing the view size down the pipeline but this is not as trivial.

plamenko avatar Jul 09 '15 09:07 plamenko