Fix again for CMYK image

This commit is contained in:
DreamPiggy 2021-02-01 21:34:51 +08:00
parent 777065d638
commit 1903ac20f3
1 changed files with 10 additions and 8 deletions

View File

@ -786,7 +786,8 @@ static CGSize SDCalculateThumbnailSize(CGSize fullSize, BOOL preserveAspectRatio
.bitsPerComponent = (uint32_t)bitsPerComponent,
.bitsPerPixel = (uint32_t)bitsPerPixel,
.colorSpace = colorSpace,
.bitmapInfo = bitmapInfo
.bitmapInfo = bitmapInfo,
.renderingIntent = CGImageGetRenderingIntent(imageRef)
};
vImage_CGImageFormat destFormat = {
.bitsPerComponent = 8,
@ -801,14 +802,15 @@ static CGSize SDCalculateThumbnailSize(CGSize fullSize, BOOL preserveAspectRatio
return nil;
}
vImage_Buffer src = {
.data = (uint8_t *)CFDataGetBytePtr(dataRef),
.width = width,
.height = height,
.rowBytes = bytesPerRow
};
vImage_Buffer dest;
vImage_Buffer src;
error = vImageBuffer_InitWithCGImage(&src, &srcFormat, nil, imageRef, kvImageNoFlags);
if (error != kvImageNoError) {
vImageConverter_Release(convertor);
CFRelease(dataRef);
return nil;
}
vImage_Buffer dest;
error = vImageBuffer_Init(&dest, height, width, destFormat.bitsPerPixel, kvImageNoFlags);
if (error != kvImageNoError) {
vImageConverter_Release(convertor);