facebook / fresco

An Android library for managing images and the memory they use.
https://frescolib.org/
MIT License
17.07k stars 3.75k forks source link

Caching post-processed images #14

Closed REWKyleB closed 9 years ago

REWKyleB commented 9 years ago

Is it possible to process the image before it is cached and cache that processed image?

plamenko commented 9 years ago

We don't support that at the moment. We were considering doing that, but there are some non-trivialities when it comes to bitmap-cache-key creation. Cache-key must reflect mutation, but we don't want to kick every other image from cache by filling it with many variants of the same image. In short, it's doable, we just haven't implemented it yet.

nbarraille commented 9 years ago

Picasso handles this by having the cache key a function of the URI, resize parameters, transformation keys, etc... IMO it's pretty important, as currently a ListView with Postprocessor will always show spinner when you scroll back.

plamenko commented 9 years ago

Yeah, agreed. I'm working on it.

KyleDBoyd commented 9 years ago

Post processing works awesome! Looking forward to the caching to make it usable in a list view

cabbage commented 9 years ago

+1 for post-processed image caching!

Currently I'm post-processing background images which change a lot since they're bound to a list which updates the background every time a new list-item is displayed. And running a RenderScript blur over those images every time could be a battery drainer (I suppose)

tyronen commented 9 years ago

Added in v0.6.0. See http://frescolib.org/docs/modifying-image.html#caching-postprocessed-images.