Reputation: 8952
I am loading image from url on a image-view. If the resolution of the image is 4000 * 2400 ,size of image is 1.6MB then when I load image. Memory increase upto 30MB just for image load. But if size is less than 10 KB then size does not increase. I know I must use small image for loading as thumb image but just for learning I want to know this.
I am using below code to load image
self.imgStore.kf.setImage(with: url, placeholder: #imageLiteral(resourceName: "placeholder"), options: nil, progressBlock: { (val, val1) in }) { (image, error, cache, url) in
DILog.print(items: "image recived")
}
Upvotes: 2
Views: 844
Reputation: 19156
1.5MB is compressed size. PNG's are decompressed in memory and it consume memory on pixel basis (RGBA). So the the size will be 4000 * 2400 * 4 ~= 38MB
If your image are too big and you can't change the resolution.
Upvotes: 1