Search code examples
androidimageimageviewfresco

Fresco SimpleDraweeView pixelated image


SimpleDraweeView is loading a pixelated bitmap image from the external storage.

enter image description here

I am copying the image from assets folder to the external storage through this

private OutputStream copy(InputStream in, OutputStream out) throws IOException{
    // Transfer bytes from in to out
    byte[] buf = new byte[in.available()];
    int len;
    while ((len = in.read(buf)) > 0) {
        out.write(buf, 0, len);
    }
    in.close();
    out.close();
    return out;
}

then I am setting the image of the SimpleDraweeView through this

Fresco.getImagePipeline().evictFromMemoryCache(uri);
    Fresco.getImagePipelineFactory().getMainDiskStorageCache().remove(new SimpleCacheKey(uri.toString()));
    Fresco.getImagePipelineFactory().getSmallImageDiskStorageCache().remove(new SimpleCacheKey(uri.toString()));

    Postprocessor postprocessor = new BasePostprocessor() {
        @Override
        public void process(Bitmap bitmap) {

            });
        }
    };

    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
            .setPostprocessor(postprocessor)
            .build();

    PipelineDraweeController controller = (PipelineDraweeController)
            Fresco.newDraweeControllerBuilder()
                    .setImageRequest(request)
                    .setOldController(header.getController())
                    .build();

    header.setController(controller);

Solution

  • This was a known bug. It was fixed in Fresco 0.9.0. Please try again and open a new GitHub issue if you are still experiencing this.