Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why decode image after [UIImage initwithData:] ? #602

Closed
limboy opened this issue Jan 6, 2014 · 4 comments
Closed

why decode image after [UIImage initwithData:] ? #602

limboy opened this issue Jan 6, 2014 · 4 comments
Milestone

Comments

@limboy
Copy link

limboy commented Jan 6, 2014

- (UIImage *)diskImageForKey:(NSString *)key
{
    NSData *data = [self diskImageDataBySearchingAllPathsForKey:key];
    if (data)
    {
        UIImage *image = [UIImage sd_imageWithData:data];
        image = [self scaledImageForKey:key image:image];
        image = [UIImage decodedImageWithImage:image];
        return image;
    }
    else
    {
        return nil;
    }
}

what's the benefit of this approach instead of using CGImageSourceCreateWithData(CFDataRef data, CFDictionaryRef options) directly ?

@andrey-krukovskiy
Copy link

👍
Current solution uses much memory, and we experienced problems with it. Seems that it may results in crashes due to huge memory consumption in some cases.
I found that current solution was introduced by PR #33. But when we replace content of decodedImageWithImage: method with just return image; it working not worse than early.

@phamquy
Copy link

phamquy commented Mar 10, 2014

i have the same question, but as stated in #33, "undecoded" will cause "visible delay". I think it would be better solution if we can opt out "forceDecode" option.
@andrey-krukovskiy what do you meant by "working not worse than early"?

@andrey-krukovskiy
Copy link

I meant that no some visible delays were for me. May be for last 2 year performance of devices were increased, or may be I just miss it. I'm not sure in it, because I'm not performed special comparison for it.

@mythodeia
Copy link
Contributor

now there is the option
shouldDecompressImages available for both
SDImageCache & SDWebImageDownloader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants