Search code examples
iosobjective-cuiimagegpuimage

PNG UIImage with transparency loosing alpha after GPUImageBrightnessFilter


I'm trying to manipulate an UIImage brightness with GPUImageBrightnessFilter with the following code.

GPUImagePicture *source = [[GPUImagePicture alloc] initWithImage:_imgMask smoothlyScaleOutput:YES];
GPUImageBrightnessFilter *brightness = [[GPUImageBrightnessFilter alloc] init];

[source addTarget: brightness];
[brightness addTarget:GPUImageView];

[source processImage];

But the output image is generated without the original transparency. Am I missing something to generate the output image with the original transparency?

Thanks


Solution

  • To my knowledge, GPUImagePicture does not support an alpha channel when translated back to a UIImage.

    You could, however, display the native GPUImagePicture in a GPUImageView - setting the backgroundColor property of the imageView to [UIColor clearColor].

    See this ticket for more info.