BradLarson / GPUImage

An open source iOS framework for GPU-based image and video processing
http://www.sunsetlakesoftware.com/2012/02/12/introducing-gpuimage-framework
BSD 3-Clause "New" or "Revised" License
20.24k stars 4.61k forks source link

Color Blend #426

Open iphoneguy opened 12 years ago

iphoneguy commented 12 years ago

Hi Brad

I am a great fan of your library, and i am learning doing good things out of it.

I have used one of the blend filters to create some effect, the issue is when i am blending two images, i dont want too much light to be applied to the photo. Ie i am using color dodge filter and it when i am blending it with the other picture it adds too much light to it, the property of the dodge effect is to add whiteness to an object. And color burn , burns it ie darkens it.

What i am trying to do is not burn or dodge it, just color mix it. which is called as Color blend Effect in photoshop.

Is there a way your filter can be customized to merge two images without having to dodge and burn.

Please help, i will really appreciate your help.

Regards Anu

alariccole commented 12 years ago

A "Color" blend is not available in the framework right now, but there are lots of resources available online that show how to create the formula. However, all of them that I've seen require expensive conversions that result in poor shader performance.

zeusent commented 12 years ago

@alariccole I need this too and I would be more than grateful if you could point me in the right direction.

Thanks!

zeusent commented 12 years ago

I've created a blend filter in the end. I've made a pull request that can be found here.

oliverwolfson commented 12 years ago

@zeusent Hi there . I added your GPUImageColorBlendFilter to my project. Not sure if I did it correctly. It seems to recognize the class, but when I run it I get a strange result. http://owolf.net/uploads/github/colorBlend.jpg

GPUImageColorBlendFilter* blendFilter = [[GPUImageColorBlendFilter alloc] init];
//GPUImageHardLightBlendFilter* blendFilter = [[GPUImageHardLightBlendFilter alloc] init];
GPUImagePicture* picture1 = [[GPUImagePicture alloc] initWithImage:sourceImage1];
GPUImagePicture* picture2 = [[GPUImagePicture alloc] initWithImage:sourceImage2];
[picture1 processImage];
[picture2 processImage];
[picture1 addTarget:blendFilter];
[picture2 addTarget:blendFilter];
blendImage = [blendFilter imageFromCurrentlyProcessedOutputWithOrientation:sourceImage1.imageOrientation];
self.imageView.image=blendImage;