Skip to content

Commit daa8373

Browse files
committed
Keep the rendering intent information from CGImage as well
1 parent 8113caf commit daa8373

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

SDWebImageWebPCoder/Classes/SDImageWebPCoder.m

+3-1
Original file line numberDiff line numberDiff line change
@@ -888,11 +888,13 @@ - (nullable NSData *)sd_encodedWebpDataWithImage:(nullable CGImageRef)imageRef
888888
if (!colorSpace) {
889889
colorSpace = [SDImageCoderHelper colorSpaceGetDeviceRGB];
890890
}
891+
CGColorRenderingIntent renderingIntent = CGImageGetRenderingIntent(imageRef);
891892
vImage_CGImageFormat destFormat = {
892893
.bitsPerComponent = 8,
893894
.bitsPerPixel = hasAlpha ? 32 : 24,
894895
.colorSpace = colorSpace,
895-
.bitmapInfo = hasAlpha ? kCGImageAlphaLast | kCGBitmapByteOrderDefault : kCGImageAlphaNone | kCGBitmapByteOrderDefault // RGB888/RGBA8888 (Non-premultiplied to works for libwebp)
896+
.bitmapInfo = hasAlpha ? kCGImageAlphaLast | kCGBitmapByteOrderDefault : kCGImageAlphaNone | kCGBitmapByteOrderDefault, // RGB888/RGBA8888 (Non-premultiplied to works for libwebp)
897+
.renderingIntent = renderingIntent
896898
};
897899
vImage_Buffer dest;
898900
// We could not assume that input CGImage's color mode is always RGB888/RGBA8888. Convert all other cases to target color mode using vImage

0 commit comments

Comments
 (0)