Re: Adding Noise To A Picture
Lawrence D'Oliveiro <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Organization | Geek Central |
| Message-ID | <[email protected]> |
On Sat, 28 Mar 2015 11:27:31 +1300, I wrote: > It’s easy enough to generate a bunch of random pixel values, to make > an image of pure noise. Adding noice to an existing image is another > matter. Ideally what you want is exclusive-or operation between the > bits of the noise pixels and the image pixels. I figured out the right way to do this: fill a pattern surface with the full-strength noise, then mask that into the destination image (using cairo_mask or cairo_mask_surface) with the alpha channel of the mask controlling the relative proportion of the noise, from 0 for a noise-free image to 1 for total noise. > The script is here > <https://github.com/ldo/qahirah_examples/blob/master/noisy_picture>, > and you can see the output here > <http://default-cube.deviantart.com/art/Noisy-Picture-520465768>. Both updated. -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo