[cairo] How to brighten image, maintaining contrast?
Stuart Axon
stuaxo2 at yahoo.com
Thu Jun 13 10:26:51 PDT 2013
I've been trying out some of the lighten some images, is there a way to brighten an image, but maintain contrast .. so far I've played LIGHTEN, HARD_LIGHT and SOFT_LIGHT - but images end up looking washed out.. any idea of a better approach ?
S++
Code is pretty simple at the moment;
LIGHTEN_ALPHA = 0.25
LIGHTEN_OPERATOR = cairo.constants.OPERATOR_LIGHTEN
width = source_surface.get_width()
height = source_surface.get_height()
lightened = cairo.ImageSurface( cairo.constants.FORMAT_ARGB32, width, height )
with cairo.Context( lightened ) as cr:
cr.set_source_surface(source_surface)
cr.paint()
cr.set_operator( LIGHTEN_OPERATOR )
cr.set_source_rgba(1, 1, 1, LIGHTEN_ALPHA)
cr.paint()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20130613/8ae2574c/attachment.html>
More information about the cairo
mailing list