Closed bubbleguuum closed 1 year ago
It works at intended and another PEBCAK case .
I was confused because when the RoundedCorners
transformation is used, cached files are saved as PNG (because of the new transparent pixels in the corners) resulting in much bigger files that I though were original files.
It is a bit unfortunate that rounded corners results in much bigger cached files: it increases storage usage by quite a bit, cause more disk I/O at loading time and PNG seems to be generally slower than JPG decoding. There has to be a more optimized way for a few pixels shaved off corners...
Version: 4.16.0
My app loads http images that can eventually be large, to put them into thumbnail
ImageView
with round corners. I always want to cache to disk the final scaled image with the transformation (round corners) applied. From what I understand, this is whatDiskCacheStrategy.RESOURCE
should do, but it does not: if there is a transformation specified if always cache to disk the original image. If I omit the transformation, it properly caches to disk the scaled (toImageView
dimension) image.In my
AppGlideModule
, I have:The actual request is nothing special and looks like:
So to summarize, with the presence of the
RoundedCorners
transform,DiskCacheStrategy.RESOURCE
cache to disk the (potentially very big) original image and behaves likeDiskCacheStrategy.DATA
. If the transform is not specified (either removed from theAppGlideModule
or discarded withdontTransform()
passed to the request builder), the scaled image is cached to disk (without round corners obviously).What I need is the scaled image with rounded corner to be cached to disk. How can I do that ?