我该如何使用Image Magick库或obj-c代码在iPhone上复制Photoshop的“Multiply effects”?您在哪里可以找到一些示例代码呢?我还看到了这个问题。
UIImage *inputImage1 = [UIImage imageNamed:@"image1.jpg"];
GPUImagePicture *stillImageSource1 = [[GPUImagePicture alloc] initWithImage:inputImage1];
UIImage *inputImage2 = [UIImage imageNamed:@"image2.jpg"];
GPUImagePicture *stillImageSource2 = [[GPUImagePicture alloc] initWithImage:inputImage2];
然后创建并配置您的混合滤镜:
GPUImageMultiplyBlendFilter *blendFilter = [[GPUImageMultiplyBlendFilter alloc] init];
[inputImage1 processImage];
[inputImage1 addTarget:blendFilter];
[inputImage2 addTarget:blendFilter];
[inputImage2 processImage];
UIImage *filteredImage = [blendFilter imageFromCurrentlyProcessedOutput];
当前该实现存在一个缺陷,即早于iPad 2的设备具有有限的纹理尺寸,因此大于2048x2048的图像目前无法在这些老设备上处理。我正在努力解决这个问题。
我重用了Brad Larson的代码,它对我很有效。
UIImage *inputImage1 = [UIImage imageNamed:@"image1.jpg"];
GPUImagePicture *stillImageSource1 = [[GPUImagePicture alloc] initWithImage:inputImage1];
UIImage *inputImage2 = [UIImage imageNamed:@"sample.jpg"];
GPUImagePicture *stillImageSource2 = [[GPUImagePicture alloc] initWithImage:inputImage2];
GPUImageMultiplyBlendFilter *blendFilter = [[GPUImageMultiplyBlendFilter alloc] init];
[stillImageSource1 processImage];
[stillImageSource1 addTarget:blendFilter];
[stillImageSource2 addTarget:blendFilter];
[stillImageSource2 processImage];
[blendFilter useNextFrameForImageCapture];
UIImage *filteredImage = [blendFilter imageFromCurrentFramebuffer];
[self.imageView setImage:filteredImage];
imageFromCurrentlyProcessedOutput
方法来处理我的混合滤镜。有什么问题吗? - Devang