【发布时间】:2015-03-27 15:28:49
【问题描述】:
在 OSX 10.9.5 上,我试图将使用 QTkit 抓取的图像保存为 BMP 文件,但只有当我保存为 bmp 文件时,图像文件输出才会被切片(损坏),像这样
但是如果我将图像保存为 TIFF 或 PNG 文件一切都可以,这里是一个示例
我使用的代码是
-UPDATE- 仅当我在 CIImage 上应用 CIfilter *I
时,图像才会损坏
CIImage *I;
I=[Video cropImg:I];
//saving to disk
NSBitmapImageRep* rep = [[NSBitmapImageRep alloc]initWithCIImage:I];
NSImage *nsImage = [[NSImage alloc] initWithSize:rep.size];
[nsImage addRepresentation:rep];
NSData *imageData = [nsImage TIFFRepresentation];
imageData = [rep representationUsingType:NSBMPFileType properties:NULL];
if ([imageData writeToFile:targetPath atomically:NO]==NO)
{
NSLog(@"Error file");
}
如果我将 NSBMPFileType 更改为 NSPNGFileType 图像没问题,但我需要 bmp 文件
【问题讨论】:
标签: objective-c macos cocoa core-image