保留加载的 UIImages 的 alpha 问题 - 如何避免在导入时丢弃 alpha 值?
我的应用程序允许用户将具有 Alpha 值的图像保存/加载到设备上的相机胶卷中。我可以在“照片”应用程序中看到这些图像经过适当的 Alpha 处理,因为 Alpha 处理区域只是显示为黑色。但是,当我使用 valueForKey:UIImagePickerControllerOriginalImage
消息从 (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo 到
,alpha 值变成白色,使这些部分不透明。有没有办法保留这些 alpha 值?info
字典将这些图像加载回应用程序时:(NSDictionary *)info
My application lets the user save/load images with alpha values to the camera roll on the device. I can see in the Photos application that these images are appropriately alpha'd, as alpha'd areas just appear black. However, when I load these images back into the application using the valueForKey:UIImagePickerControllerOriginalImage
message to the info
dictionary from (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
, the alpha values are turned to just white, making those sections opaque. Is there a way to preserve these alpha values?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
发现了!这是我执行此操作的函数。您的里程可能会有所不同!:
Found it out! Here's my function for doing this. Your milage may vary!:
您应该使用 ALAssetsLibrary 访问原始图像,如下所述:
http://www.proace.com/2011/05/27/loading-png-images-using-uiimagepickercontroller-causes-them-to-lose-transparency-and-what-要做的事/
you should use the ALAssetsLibrary to access the original image, as described here :
http://www.proace.com/2011/05/27/loading-png-images-using-uiimagepickercontroller-causes-them-to-lose-transparency-and-what-to-do-about-it/