0

当我将图像保存到相册时,它失败了。

error info: PEG Application transferred too few scanlines

有人遇到过这个吗?谢谢。

// make data provider with data.
Float32 picSize = texture->image_size.width * texture->image_size.height * texture->bytesPerPixel;
NSLog(@"pic size:%f", picSize);
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, texture->data, texture->image_size.width * texture->image_size.height * texture->bytesPerPixel, NULL);

// prep the ingredients
int bitsPerComponent = 8;
int bitsPerPixel = 32;
int bytesPerRow = 4 * 320;
CGColorSpaceRef colorSpaceRef = CGColorSpaceCreateDeviceRGB();
CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault;
CGColorRenderingIntent renderingIntent = kCGRenderingIntentDefault;

// make the cgimage
CGImageRef imageRef = CGImageCreate(320, 480, bitsPerComponent, bitsPerPixel, bytesPerRow, colorSpaceRef, bitmapInfo, provider, NULL, NO, renderingIntent);

// then make the uiimage from that
UIImage *myImage = [UIImage imageWithCGImage:imageRef];
UIImageWriteToSavedPhotosAlbum(myImage, self, nil, nil);
4

1 回答 1

0

当我将灰度图像提供给预期它是 TrueColor 的程序时,我遇到了类似的错误消息

于 2020-05-20T18:00:43.030 回答