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

Image display deeper only on iOS 17.0 #3609

Open
wgywgy opened this issue Sep 27, 2023 · 10 comments
Open

Image display deeper only on iOS 17.0 #3609

wgywgy opened this issue Sep 27, 2023 · 10 comments
Labels
apple bug apple's bug cause our framework author's pain ImageIO Anything related to Apple ImageIO codec ios17 iOS 17 only png PNG image related

Comments

@wgywgy
Copy link

wgywgy commented Sep 27, 2023

Issue Info

Info Value
Platform Name ios
Platform Version 17.0
SDWebImage Version 5.18.0
Integration Method cocoapods
Xcode Version Xcode 15
Repro rate all the time (100%)

Issue Description and Steps

Image display deeper only on iOS 17.0(and 17.0.1)
the code is:
CGSize thumbnailSize = CGSizeMake(100, 100);
[_imgView sd_setImageWithURL:[NSURL URLWithString:@"https://raw.githubusercontent.com/wgywgy/picTest/master/222.png"]
placeholderImage:nil
options:0
context:@{SDWebImageContextImageThumbnailPixelSize : @(thumbnailSize)}];

The problem code is in SDImageIOAnimatedCoder 269 line:
imageRef = CGImageSourceCreateThumbnailAtIndex(source, index, (__bridge CFDictionaryRef)[decodingOptions copy]);
It same like ios 17 change the implement. replace with:
imageRef = CGImageSourceCreateImageAtIndex(source, index, (__bridge CFDictionaryRef)[decodingOptions copy]);
The problem is gone.

@dreampiggy
Copy link
Contributor

Provide a reproducable demo ?

@wgywgy
Copy link
Author

wgywgy commented Sep 27, 2023

The code can reproducable:
CGSize thumbnailSize = CGSizeMake(100, 100);
[_imgView sd_setImageWithURL:[NSURL URLWithString:@"https://raw.githubusercontent.com/wgywgy/picTest/master/222.png"]
placeholderImage:nil
options:0
context:@{SDWebImageContextImageThumbnailPixelSize : @(thumbnailSize)}];

@dreampiggy
Copy link
Contributor

dreampiggy commented Sep 27, 2023

The thumbnail is useful, so actually you can not simple change that into CGImageSourceCreateImageAtIndex

If Apple's bug, you'be better fire radar for Apple: https://feedbackassistant.apple.com/

@dreampiggy
Copy link
Contributor

dreampiggy commented Sep 27, 2023

@wgywgy I guess your issue (since you mentioned PNG) is the same as #3605

You can check that firstly and test again (with the avoidDecodedImage), is the behavior still the same ?

@wgywgy
Copy link
Author

wgywgy commented Sep 27, 2023

I try the follow Code (use avoidDecodedImage):

CGSize thumbnailSize = CGSizeMake(100, 100);
[_imgView sd_setImageWithURL:[NSURL URLWithString:@"https://raw.githubusercontent.com/wgywgy/picTest/master/222.png"]
placeholderImage:nil
options:SDWebImageAvoidDecodeImage
context:@{SDWebImageContextImageThumbnailPixelSize : @(thumbnailSize)}];

The behavior still the same

@dreampiggy
Copy link
Contributor

dreampiggy commented Sep 27, 2023

image

Apple's Bug, not SDWebImage's issue. Fire radar to them :(

TestiOS17PNGThumbnailBug.zip

@dreampiggy dreampiggy added apple bug apple's bug cause our framework author's pain ImageIO Anything related to Apple ImageIO codec png PNG image related ios17 iOS 17 only labels Sep 27, 2023
@dreampiggy
Copy link
Contributor

FB13208254

image

@dreampiggy
Copy link
Contributor

dreampiggy commented Sep 27, 2023

A quick hack is to disable the thumbnail decoding (Do not pass that thumbnailPixelSize) for iOS 17~iOS 17.1.

@Hoony-HU
Copy link

how to fix it

@dreampiggy
Copy link
Contributor

dreampiggy commented Nov 30, 2023

@Hoony-HU If this is iOS system framework ImageIO bug, the only workaround is to disable using thumbnailPixelSize on PNG

Using the ResizeTransformer with your thumbnail size, and do full decoding.

Transformer: https://github.com/SDWebImage/SDWebImage/wiki/Advanced-Usage#image-transformer-50

This may workaround the issue.

However, you MUST upgrade to v5.18.5+, that version contains a hacky workaround for full image decoding on PNG.

https://github.com/SDWebImage/SDWebImage/releases/tag/5.18.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apple bug apple's bug cause our framework author's pain ImageIO Anything related to Apple ImageIO codec ios17 iOS 17 only png PNG image related
Projects
None yet
Development

No branches or pull requests

3 participants