Re: How to brighten image, maintaining contrast?
Stuart Axon <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
Thanks, got this working using this in the end. S++ >________________________________ > From: Bill Spitzak <[email protected]> >To: Stuart Axon <[email protected]> >Cc: "[email protected]" <[email protected]> >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() >> >> > > > -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo