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

Change to use kCGImageSourceCreateThumbnailFromImageAlways to solve the issue when HEIC/JPEG contains an embed thumbnail but its size is much smaller than provided maxPixelSize #3038

Merged

Conversation

dreampiggy
Copy link
Contributor

@dreampiggy dreampiggy commented Jun 12, 2020

New Pull Request Checklist

  • I have read and understood the CONTRIBUTING guide

  • I have read the Documentation

  • I have searched for a similar pull request in the project and found none

  • I have updated this branch with the latest master to avoid conflicts (via merge from master or rebase)

  • I have added the required tests to prove the fix/feature I am adding

  • I have updated the documentation (if necessary)

  • I have run the tests and they pass

  • I have run the lint and it passes (pod lib lint)

This merge request fixes / refers to the following issues: #3036

Pull Request Description

This close #3036

Demo URL(JPEG which contains an embed thumbnail 120x160): http://resource-fat.7kid.com/7kid/moment/img/20206/55e26e85-a962-4d98-a51f-107b55911b24_6.jpg

You can use imagemagic to check the metadata.

  • Use kCGImageSourceCreateThumbnailFromImageIfAbsent : Return 120x160

image

  • Use kCGImageSourceCreateThumbnailFromImageAlways: Return 2975x3966

image

…he issue when HEIC/JPEG contains an embed thumbnail but its size is much smaller than provided `maxPixelSize`
@dreampiggy dreampiggy added the fix label Jun 12, 2020
@dreampiggy dreampiggy added this to the 5.8.1 milestone Jun 12, 2020
@dreampiggy
Copy link
Contributor Author

kCGImageSourceCreateThumbnailFromImageIfAbsent Behavior:

  1. If there are some embed thumbnail in JPEG/HEIC container, the thumbnail size is 200x200, full image size is 1000x1000, input kCGImageSourceThumbnailMaxPixelSize is 400x400. The final return size will be 200x200, not expected 400x400.

Have to use kCGImageSourceCreateThumbnailFromImageAlways :)

@dreampiggy dreampiggy added the apple bug apple's bug cause our framework author's pain label Jun 12, 2020
@codecov
Copy link

codecov bot commented Jun 12, 2020

Codecov Report

Merging #3038 into master will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3038      +/-   ##
==========================================
- Coverage   84.06%   84.03%   -0.03%     
==========================================
  Files          69       69              
  Lines        7544     7549       +5     
==========================================
+ Hits         6342     6344       +2     
- Misses       1202     1205       +3     
Flag Coverage Δ
#ios 84.03% <100.00%> (-0.08%) ⬇️
#macos 83.77% <100.00%> (-0.17%) ⬇️
Impacted Files Coverage Δ
SDWebImage/Core/SDAnimatedImagePlayer.m 89.21% <100.00%> (ø)
SDWebImage/Core/SDImageIOAnimatedCoder.m 85.39% <100.00%> (ø)
...ebImage/Core/SDWebImageDownloaderRequestModifier.m 83.87% <100.00%> (+1.72%) ⬆️
SDWebImage/Core/SDWebImageTransition.m 74.54% <100.00%> (ø)
SDWebImage/Private/SDAsyncBlockOperation.m 85.36% <0.00%> (-4.88%) ⬇️
SDWebImage/Core/SDWebImagePrefetcher.m 90.05% <0.00%> (-1.76%) ⬇️
SDWebImage/Core/SDWebImageManager.m 86.85% <0.00%> (+0.23%) ⬆️
SDWebImage/Core/SDWebImageDownloaderOperation.m 92.64% <0.00%> (+0.29%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f8fa412...6a22734. Read the comment docs.

@dreampiggy dreampiggy merged commit 6f5f835 into SDWebImage:master Jun 12, 2020
@dreampiggy dreampiggy deleted the bugfix_embed_thumbnail_max_pixel_size branch June 12, 2020 08:04
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 fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SDWebImageScaleDownLargeImages may turn a big picture into a very small picture which is not what we expect
2 participants