[cairo] How to brighten image, maintaining contrast?
Stuart Axon
stuaxo2 at yahoo.com
Fri Jun 14 05:12:57 PDT 2013
Thanks, got this working using this in the end.
S++
>________________________________
> From: Bill Spitzak <spitzak at gmail.com>
>To: Stuart Axon <stuaxo2 at yahoo.com>
>Cc: "cairo at cairographics.org" <cairo at cairographics.org>
>Sent: Thursday, June 13, 2013 9:36 PM
>Subject: Re: [cairo] How to brighten image, maintaining contrast?
>
>
>Try using the image itself as a source.
>
>Stuart Axon wrote:
>> 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/20130614/a4ce312d/attachment.html>
More information about the cairo
mailing list