Search code examples
androidimage-processingimage-cachingprogressive-download

Displaying interlaced (progressive) Image in ImageView android


I am trying to display a JPEG image as it downloads like this library but its for IOS is there anything like this in android.

While R&D found this but its also for ios.

1) Right now i am using this way to load it works but the overhead is i have to load twice.

2) Also used fresco with .setProgressiveRenderingEnabled(true) but didt notice any major change.


Solution

  • First of all, you need to make sure your jpeg support progressive. Here's how

    The easiest way to load progressive JPEG is using Fresco. But you need extra configuration to do this.

    Here's the simplest code snippet to load progressive JPEG.

    ImageRequest request = ImageRequestBuilder
    .newBuilderWithSource(Uri.parse("http://pooyak.com/p/progjpeg/jpegload.cgi?o=1"))
    .setProgressiveRenderingEnabled(true)
    .build();
    DraweeController controller = Fresco.newDraweeControllerBuilder()
        .setImageRequest(request)
        .setOldController(imageView.getController())
        .build();
    imageView.setController(controller);
    
    // imageView is fresco SimpleDraweeView
    

    Good luck!