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

Decode images only up to a maximum size #884

Closed
wants to merge 1 commit into from
Closed

Conversation

bm-i
Copy link
Contributor

@bm-i bm-i commented Sep 1, 2014

Decoding very large images may lead to memory warnings or even crashes. This pull request introduces a new property maxImageSize on SDImageCache that is used for all image decoding operations.

[UImage +decodedImageWithImage:maxSize:] will detect if the undecoded image's size exceeds the maximum size, and scale it down, respecting the aspect ratio. Only if the image is downscaled, the context's interpolation quality is adjusted CGContextSetInterpolationQuality(context, kCGInterpolationHigh) to prevent staggering (see http://vocaro.com/trevor/blog/2009/10/12/resize-a-uiimage-the-right-way/)

@bpoplauschi
Copy link
Member

Might be a duplicate of #894

@bpoplauschi bpoplauschi added this to the 4.0.0 milestone Nov 5, 2014
@Friend-LGA
Copy link

+1

@bpoplauschi
Copy link
Member

#787 adds a more robust solution to dealing with large images.

@bpoplauschi bpoplauschi closed this Oct 6, 2016
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

Successfully merging this pull request may close these issues.

None yet

3 participants