-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
I see that by default, SDWebImage use SDWebImageDecoder
to decompress UIImage. AFNetworking also does this with itsImageSerializer
I'm about to detect the size and resize the image, in this callback
- (UIImage *)imageManager:(SDWebImageManager *)imageManager
transformDownloadedImage:(UIImage *)image
withURL:(NSURL *)imageURL
Size
I see that the size (in byte) of the original image from the server and image saved on disk are the same. So this "decompression" does not increase the file size
Resize
I follow Image Resizing Techniques, using UIGraphicsBeginImageContextWithOptions & UIImage -drawInRect:
approach, with half CGRect as the original transformDownloadedImage
However, I see that
- The resized image is the same size (in dimension) as the
transformDownloadedImage
- The size (in byte) of the resized image is of much smaller size than the
transformDownloadedImage
(80KB compared to 2.5MB)
Size (in byte) detection
I use Get size of a UIImage (bytes length) not height and width
However, I see that
- The size (in byte) is not correct
If I use normal [UIImage imageNamed:"file_name"], then all is correct. So there must be something about the "SDWebImageDecoder decompression" that make all of this fails, or my images contain unrelated image meta data
I'd like to know, thanks
Activity
onmyway133 commentedon Jun 11, 2015
So it has nothing to do with
decompression
, it is because the images contain unused meta dataResize
UIGraphicsBeginImageContextWithOptions & UIImage -drawInRect:
strips the meta data out, so the resized size is much decreasedSize (in byte) detection
The result size does not take meta data into account
bpoplauschi commentedon Jun 29, 2015
@onmyway133 why did you close this?
mythodeia commentedon Jun 29, 2015
@bpoplauschi i think he answered his own question regarding the size of the image before and after the decoding
onmyway133 commentedon Jun 29, 2015
@bpoplauschi @mythodeia I see that the problem has nothing to do with
SDWebImageDecoder
, it is just misunderstanding the usage of image. So I think it is enough :] Also, I sum up in this Understanding SDWebImage – Decompressionbpoplauschi commentedon Jul 1, 2015
Great post. Thanks for that.