iOS 14 Colorspace issue

I updated Xcode Beta 4 for supporting iOS 14 update,
and when I checked the our app, we've found the issue that image color changed when it use CGContext draw image.

so I just tried to put sRGB color space when creating CGContext, but It has same problem. how can we solve the issue ? is there anything change when we use CGContext something? It seems like always use P3 colorspace when drawing image.
Could you please post some code? How do you set up the CGContext?

Maybe also consider using the (newish) UIGraphicsImageRenderer API instead of setting up CGContext manually. This should be more reliable with consistent results across different devices.

(And please also tag [Core Graphics] in you question instead of [Core Image].)
@FrankSchlegel

thank you for ur answer. I just setting up CGContext like this. even I just put Device colorspace, It's same wrong result image. here's the code.

(and I try to edit my post but I can only edit my reply ;;)

Code Block
- (UIImage *)resizeImage:(UIImage *)originalImage size:(CGSize)size
{
  @autoreleasepool {
    CGContextRef context=nil;
    CGColorSpaceRef colorSpace=nil;
    CGSize ceiledSize = CGSizeMake(ceil(size.width), ceil(size.height));
    colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
    CGFloat pixelsWidth = ceiledSize.width;
    CGFloat pixelsHeight = ceiledSize.height;
    CGFloat bitmapBytesPerRow  = (pixelsWidth * 4);// 1
    CGFloat bitmapByteCount   = (bitmapBytesPerRow * pixelsHeight);
    uint8_t *bitmapData = calloc( bitmapByteCount, sizeof(uint8_t));
    context = CGBitmapContextCreate(bitmapData, ceiledSize.width, ceiledSize.height, 8, bitmapBytesPerRow,
                    colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrderDefault);
    CGContextDrawImage(context, CGRectMake(0.0, 0.0, ceiledSize.width, ceiledSize.height), originalImage.CGImage);
    CGImageRef cgImage = CGBitmapContextCreateImage(context);
    UIImage *resultImage = [[UIImage alloc] initWithCGImage:cgImage];
    CGImageRelease(cgImage);
    CGContextRelease(context);
    CGColorSpaceRelease(colorSpace);
    free(bitmapData);
    return resultImage;
  }
}

I try to use vImage functions too. but the result image changed color.

Code Block
- (UIImage *)resizeImage:(UIImage *)originalImage size:(CGSize)size
{
//  CGColorSpaceRef colorspace = CGImageGetColorSpace(originalImage.CGImage);
//  CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
  CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
   
  vImage_CGImageFormat format;
  format.bitsPerComponent = 8;
  format.bitsPerPixel = 32;
  format.bitmapInfo = (CGBitmapInfo)(kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrderDefault); //ARGB
//  format.bitmapInfo = (CGBitmapInfo)(kCGImageAlphaPremultipliedLast | kCGBitmapByteOrderDefault); //RGBA
  format.decode = nil;
  format.colorSpace = colorspace;
  format.renderingIntent = kCGRenderingIntentDefault;
   
  CGSize ceiledSize = CGSizeMake(ceil(size.width), ceil(size.height));
  vImage_Error error = kvImageNoError;
     
  // Create source buffer
  vImage_Buffer sourceBuffer;
  error = vImageBuffer_InitWithCGImage(&sourceBuffer, &format, nil, originalImage.CGImage, kvImageNoFlags);
  if(error != kvImageNoError) {
    NSLog(@"ERROR: vImage SOURCE IMAGE INIT");
    return NULL;
  }
   
  // Create target Buffer
  vImage_Buffer targetBuffer;
  error = vImageBuffer_Init(&targetBuffer, ceiledSize.height, ceiledSize.width, format.bitsPerPixel, kvImageNoFlags);
  if(error != kvImageNoError) {
    NSLog(@"ERROR: vImage TARGET IMAGE INIT");
    return NULL;
  }
   
  // Scale Image
  error = vImageScale_ARGB8888(&sourceBuffer, &targetBuffer, nil, kvImageHighQualityResampling);
  if(error != kvImageNoError) {
    NSLog(@"ERROR: vImage SCALE");
    return NULL;
  }
   
  // Create Image
  CGImageRef targetCGImage = vImageCreateCGImageFromBuffer(&targetBuffer, &format, nil, nil, kvImageNoFlags, &error);
  if(error != kvImageNoError) {
    NSLog(@"ERROR: vImage CREATE CGImage");
    return NULL;
  }
   
  UIImage *resizedImage = [UIImage imageWithCGImage:targetCGImage];
   
  free(sourceBuffer.data);
  free(targetBuffer.data);
  CGColorSpaceRelease(colorspace);
   
  return resizedImage;
}

and I just tested that u recommand me. unfortunately, It doesn't work too.
if I use something wrong, plz tell me

Code Block
- (UIImage *)resizeImage:(UIImage *)originalImage size:(CGSize)size
{
  CGSize ceiledSize = CGSizeMake(ceil(size.width), ceil(size.height));
   
  UIGraphicsImageRendererFormat *format = [[UIGraphicsImageRendererFormat alloc] init];
  format.scale = 0.5;
   
  UIGraphicsImageRenderer *renderer = [[UIGraphicsImageRenderer alloc] initWithSize:ceiledSize format:format];
  UIImage *resultImage = [renderer imageWithActions:^(UIGraphicsImageRendererContext * _Nonnull rendererContext) {
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextDrawImage(context, CGRectMake(0.0, 0.0, ceiledSize.width, ceiledSize.height), originalImage.CGImage);
  }];
   
  CGContextRelease(context);
  CGColorSpaceRelease(colorSpace);
   
  return resultImage;
}


iOS 14 Colorspace issue
 
 
Q