Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ DerivedData/
*.perspectivev3
!default.perspectivev3
xcuserdata/
xcshareddata/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ohh, This also shouldn't be added to this place! You can see #2585 firstly.


## Other
*.moved-aside
Expand Down
3 changes: 0 additions & 3 deletions SDWebImageWebPCoder.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion SDWebImageWebPCoder/Classes/SDImageWebPCoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,16 @@ - (NSTimeInterval)sd_frameDurationWithIterator:(WebPIterator)iter {

// Create and return the correct colorspace by checking the ICC Profile
- (nonnull CGColorSpaceRef)sd_colorSpaceWithDemuxer:(nonnull WebPDemuxer *)demuxer CF_RETURNS_RETAINED {
CGColorSpaceRef colorSpaceRef = NULL;
#if SD_UIKIT || SD_WATCH
colorSpaceRef = [SDImageCoderHelper colorSpaceGetDeviceRGB];
CGColorSpaceRetain(colorSpaceRef);
return colorSpaceRef;
#else
// WebP contains ICC Profile should use the desired colorspace, instead of default device colorspace
// See: https://developers.google.com/speed/webp/docs/riff_container#color_profile

CGColorSpaceRef colorSpaceRef = NULL;

uint32_t flags = WebPDemuxGetI(demuxer, WEBP_FF_FORMAT_FLAGS);

if (flags & ICCP_FLAG) {
Expand Down Expand Up @@ -451,6 +457,7 @@ - (nonnull CGColorSpaceRef)sd_colorSpaceWithDemuxer:(nonnull WebPDemuxer *)demux
}

return colorSpaceRef;
#endif
}

#pragma mark - Encode
Expand Down