将 ciimage 转换为可写格式
我需要将 CIImage 转换为可以写入磁盘的格式。
目前我正在使用以下代码将其转换为 JPG 格式。
NSBitmapImageRep* rep = [[[NSBitmapImageRep alloc] initWithCIImage:result] autorelease];
NSData *JPEGData = [rep representationUsingType:NSJPEGFileType properties:nil];
[JPEGData writeToFile:targetPath atomically:YES];
但实际内存使用量却高达 100 MB 以上。我的应用程序需要我处理大量图像,因此我需要优化内存使用。
任何人都可以建议什么吗???
I need to convert CIImage
to a format which could be written to disk.
Currently I am using the following code to convert it to JPG format .
NSBitmapImageRep* rep = [[[NSBitmapImageRep alloc] initWithCIImage:result] autorelease];
NSData *JPEGData = [rep representationUsingType:NSJPEGFileType properties:nil];
[JPEGData writeToFile:targetPath atomically:YES];
But the real memory usage shoots up to above 100 MB . My application requires me to handle a large number of images so i need to optimise my memory usage.
Can anyone please suggest anything ???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果是累积内存问题,而不仅仅是一张图像,您可以尝试将最后两行包装在您自己的自动释放池中:
If it's the cumulative memory that's an issue, and not just one image, you can try wrapping the two last lines in your own autorelease pool: