sketch icon indicating copy to clipboard operation
sketch copied to clipboard

[Feature] Ability to render low resolution then high resolution

Open IacobIonut01 opened this issue 9 months ago • 1 comments

As the title says, I would love to have the ability to render lower resolution of the image firstly then if the composition is still on the screen, to try to render the max available resolution (or size). (it would be nice to be compatible with zoomimage - the subsampling image - as well)

This is kind of the behaviour Glide has.

My use-case is a Gallery app where fast loading images are a must.

Thanks for the amazing Sketch & ZoomImage library!

IacobIonut01 avatar Mar 18 '25 11:03 IacobIonut01

Let’s first imagine the general implementation logic of this function:

  1. Add a new attribute to ImageRequest to set the uri for thumbnails
  2. Concurrently load thumbnails and original images when memory cache and result cache are detected without original images
  3. If the thumbnail is loaded successfully, it will be displayed on the page through the onStart of Target.
  4. This solution is compatible with ZoomImage

In addition, we can discuss the usage scenarios of this function

  1. You may not need it very much when loading the local album, because the local thumbnail was not generated locally during the first loading, and the local result cache was already available during the second loading (equivalent to thumbnails), so there was no thumbnail.
  2. Therefore, you need to use it when loading a network album. If there are different resolution versions of the same picture on the server, you can configure the original picture and thumbnails at the same time when loading the picture.

But at present I have other things to be busy with, and it may be delayed for a while, which will be great if you are willing to contribute the code

panpf avatar Mar 19 '25 02:03 panpf