<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Thanks, got this working using this in the end.</span></div><div></div><div> </div><div>S++<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;">  <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1">  <font size="2" face="Arial"> <b><span style="font-weight:bold;">From:</span></b> Bill Spitzak <spitzak@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> Stuart Axon <stuaxo2@yahoo.com> <br><b><span style="font-weight: bold;">Cc:</span></b> "cairo@cairographics.org" <cairo@cairographics.org> <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, June 13,
 2013 9:36 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [cairo] How to brighten image, maintaining contrast?<br> </font> </div> <div class="y_msg_container"><br>Try using the image itself as a source.<br><br>Stuart Axon wrote:<br>> I've been trying out some of the lighten some images, is there a way to <br>> brighten an image, but maintain contrast .. so far I've played LIGHTEN, <br>> HARD_LIGHT and SOFT_LIGHT - but images end up looking washed out.. any <br>> idea of a better approach ?<br>>  <br>> <br>> S++<br>> <br>> <br>> Code is pretty simple at the moment;<br>> <br>> <br>>         LIGHTEN_ALPHA = 0.25<br>>         LIGHTEN_OPERATOR = cairo.constants.OPERATOR_LIGHTEN<br>> <br>>         width = source_surface.get_width()<br>>         height = source_surface.get_height()<br>> <br>>
 <br>>         lightened = cairo.ImageSurface( cairo.constants.FORMAT_ARGB32, <br>> width, height )<br>>         with cairo.Context( lightened ) as cr:<br>>             cr.set_source_surface(source_surface)<br>>             cr.paint()<br>> <br>>             cr.set_operator( LIGHTEN_OPERATOR )<br>>             cr.set_source_rgba(1, 1, 1, LIGHTEN_ALPHA)<br>>             cr.paint()<br>> <br>> <br><br><br></div> </div> </div> </blockquote></div>   </div></body></html>