RexOnRoids
RexOnRoids

Reputation: 14040

Any way to BRIGHTEN a UIImage without using OpenGL ES?

Does anyone know of a way to simply and effectively brighten a UIImage by a specific amount? I am currently fiddling with the Apple Sample Code Example GLImageProcessing with poor results...My app currently does not use OpenGLES or EAGLViews and it is awkward trying to bridge the technology.

Upvotes: 2

Views: 905

Answers (2)

Jon Hess
Jon Hess

Reputation: 14247

You could render the UIImage into a CGBitmapContext. And then you should have a pointer to the raw bytes of the image. At that point you could do anything you'd like with the bytes, including brighten them. After that you can create a new CGImageRef from the bytes.

This would all be on the CPU, which might not perform as well as an OpenGL solution depending on the image size.

Upvotes: 4

jtbandes
jtbandes

Reputation: 118671

That depends what you mean by "brighten". You can overlay colors easily, and you can probably figure out some blending mode that will do what you want. Look through the CG functions and documentation (I'd post in more detail, but I can't right now).

Upvotes: 2

Related Questions