UIImagePNGRepresentation和蒙版图像
我使用iphone博客的函数创建了一个蒙版图像:
UIImage * imgToSave = [self maskImage:[UIImage imageNamed:@“pic.jpg”] withMask:[UIImage imageNamed:@“sd-face-mask.png”]];
在UIImageView中看起来不错
UIImageView *imgView = [[UIImageView alloc] initWithImage:imgToSave];
imgView.center = CGPointMake(160.0f, 140.0f);
[self.view addSubview:imgView];
UIImagePNGRepresentation保存到磁盘:
[UIImagePNGRepresentation(imgToSave)writeToFile:[self findUniqueSavePath] atomically:YES];
UIImagePNGRepresentation返回看起来不同的图像的NSData。
输出是反向图像掩码。
现在可以在文件中看到应用程序中剪切的区域。
现在删除了应用程序中可见的区域。可见性正好相反。
我的面具旨在除去图片中的脸部区域以外的所有内容。 UIImage在应用程序中看起来正确,但在我将其保存在磁盘上后,文件看起来相反。面部被移除,但其他一切都在那里。
如果你能提供帮助,请告诉我!
没有找到相关结果
已邀请:
2 个回复
揽芳僵迷仇
刷骸码