Adding Noise To A Picture
Lawrence D'Oliveiro <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Organization | Geek Central |
| Message-ID | <[email protected]> |
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. After experimenting with various Cairo operators, the best effect I could find was with OPERATOR_DIFFERENCE. I use paint_with_alpha to apply the noise pattern as a mask, and the alpha becomes the noise strength: crank this up to 1, and much (thought not all) of the original image detail disappears. 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>. Try modifying the script if you have some other ideas. -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo