Update filtered image
Sun, 10/07/2012 - 11:53
Interestingly enough, it looks like the procedure (pseudo code)...
-(void)viewDidLoad { create filter myimage.image = [filter imageByFilteringImage:originalImage]; } -(void)calledLater { update filter myimage.image = [filter imageByFilteringImage:originalImage]; }
...works only in the simulator. In the device the image is not updated.
Thanks!
Tue, 10/09/2012 - 02:44
#2
Thanks Brad for the info, this is very useful to know! Would GPUImagePicture+GPUImageView make it work? (ref: http://www.sunsetlakesoftware.com/forum/how-make-filter-animations)
That's because of the way that I optimize image downloads when running on iOS hardware. If you use -imageByFilteringImage:, I memory map between the final filtered frame and the resulting UIImage to save memory and have a much faster image download process from OpenGL ES. However, it means that the filter will be locked to that image until the original image is deallocated.
You'll have to get rid of the original image first (perhaps by setting its property to nil) before re-filtering the source image.
This doesn't happen in the Simulator, because I disable this memory caching optimization there due to the Simulator not supporting it.