I want to save the processed photos to the album
AllLuckly opened this issue · 2 comments
AllLuckly commented
This is a very good framework, I want to save the processed photos to the album, but can't find the corresponding method, I see the code is directly loaded View:
let image = ImagePIX()
image.image = self.myImage
let edge = EdgePIX()
edge.input = image
edge.strength = 3
edge.view.frame = myImageView.bounds
self.view.addSubview(edge.view)
Can't get image information of edge.view
heestand-xyz commented
Hi, thanks!
You can get a UIImage
from the .renderedImage
method of a PIX
.
Save code:
guard let image: UIImage = edge.renderedImage else {
print("image not avalible")
return
}
UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil)
If the image is not available, you might need to wait until the image is loaded, like this:
edge.nextTextureAvalible {
// save code here
}
Remember to add NSPhotoLibraryUsageDescription
to your info.plist.
AllLuckly commented
is very good!👍🏻