Image filter Art--Snow filter

Source: Internet
Author: User
Tags image filter

Today to introduce a snow filter, you can make your summer photos instantly turned into a snowy scene Oh! First look at the following:

The above three images are (a) the original image, (b) PS, (c) C # code

This snow filter is also relatively simple, according to the previous steps, we introduced the PS implementation process and the code implementation process.

The PS implementation process is as follows:

1. Open the original image, copy layer a, new layer mask, fill with black;

2, filter -- noise - -Add Noise:

3, Blur -- further blur:

4, adjust the color scale:

5, Gaussian blur, mixed with a , select Blend Layer - color Filter Mode:

6, the original image to bring out cold tones:

This will come out of the snow effect, in fact, we will find that this filter with a blog in the Rain Filter is similar, the key is the production of templates, we can compare a bit of hehe.

Then let's introduce the Code implementation:

Here the template, I have placed in the resource package, we can directly take to use, if the size is not appropriate, then self-transformation can be. The implementation of this code can be simplified to two steps:

1, the original map to color, bring up a special winter cold, that is, more blue components;

2, the adjusted image and template for the "filter" layer to mix;

Here is the main code:

Amespace specialeffectdemo{Unsafe class Snowfilter {private Bitmap curbitmap = null;        Private Bitmap snowmap = null;            Public Snowfilter (Bitmap src,bitmap map) {this.curbitmap = src;        This.snowmap = map;        } public Bitmap Apply () {return rainfilterprocess ();            } private Bitmap rainfilterprocess () {Bitmap temp = Coldeffect (CURBITMAP);       return Specialeffectclass.doeffect (temp, Snowmap, 0, (int) SpecialEffectClass.EffectMode.MODE_FILTERCOLOR);//Filter Processing}            Private Bitmap Coldeffect (Bitmap srcbitmap) {Bitmap src = new Bitmap (SRCBITMAP); int w = src.            Width; int h = src.            Height;            int b = 0,g = 0,r = 0; int[] MR = new int[] {0, 0, 0, 1, 1, 3, 4, 4, 5, 5, 6, 6, 7, 8, 9, 10, 10, 10, 11, 13, 13, 14, 14, 15, 16, 16, 17, 18, 19 , 20, 21, 21, 22, 22, 23, 24, 26, 25, 27, 27, 29, 29, 30, 31, 33, 32, 34, 34, 36, 36, 37, 38, 39, 39, 40, 41, 43, 42, 43, 45, 47, 47, 48, 49, 51, 51, 52, 53, 55, 56, 57, 57, 58, 58, 58, 59, 61, 62, 63, 63, 65, 65, 66, 67, 69, 70, 71, 71, 73, 73, 74, 75, 77, 78, 79, 79, 81, 81, 82, 83, 85, 86, 87, 87, 89, 89, 90 , 95, 95, 97, 97, 98, 99, 101, 103, 104, 103, 106, 106, 107, 108, 110, 111, 112, 112, 114, 114, 115, 116, 118, 119, 119, 1 20, 122, 122, 123, 124, 126, 127, 128, 128, 129, 129, 130, 132, 134, 137, 138, 138, 140, 140, 139, 140, 142, 145, 145, 145 , 147, 147, 149, 151, 153, 154, 154, 154, 156, 156, 157, 158, 160, 163, 164, 162, 164, 164, 167, 167, 170, 172, 172, 172, 174, 174, 176, 176, 178, 180, 180, 180, 182, 182, 183, 185, 187, 190, 191, 191, 191, 191, 192, 195, 197, 199, 200, 200, 20  2, 201, 202, 203, 207, 206, 207, 209, 209, 211, 213, 213, 216, 217, 217, 217, 220, 220, 220, 221, 224, 226, 227, 227, 230,            230, 231, 232, 234, 235, 235, 237, 238, 238, 240, 241, 243, 243, 246, 246, 248, 248, 249, 250, 253, 254, 255, 255}; int[] MG = new in[t[] {2, 2, 4, 7, 10, 12, 13, 13, 15, 15, 18, 18, 21, 22, 23, 24, 26, 26, 27, 29, 31, 32, 34, 33, 36, 36, 37, 39, 40, 41, 42, 42, 46, 46, 47, 48, 50, 51, 53, 53, 55, 55, 56, 57, 59, 60, 62, 62, 64, 64, 65, 66, 67, 69, 70, 69, 73, 72 , 79, 80, 79, 81, 81, 82, 83, 85, 86, 87, 87, 90, 90, 90, 91, 93, 94, 95, 95, 97, 97, 98, 99, 101, 102, 103, 103, 105, 105 , 106, 107, 109, 110, 111, 111, 113, 113, 114, 115, 117, 118, 119, 119, 121, 121, 122, 123, 125, 126, 127, 127, 128, 128, 130, 131, 133, 133, 134, 135, 136, 136, 137, 138, 140, 141, 142, 142, 144, 144, 145, 146, 148, 149, 149, 148, 150, 150, 15  1, 152, 154, 155, 156, 156, 159, 159, 160, 160, 162, 163, 164, 164, 166, 166, 167, 168, 170, 171, 171, 171, 173, 173, 175, 175, 177, 178, 180, 180, 180, 180, 181, 182, 184, 184, 185, 186, 188, 188, 188, 188, 191, 192, 193, 193, 195, 195, 196, 1 96, 198, 198, 200, 200, 202, 202, 203, 203, 205, 206, 207, 207, 209, 209, 210, 211, 213, 213, 214, 214, 216, 217, 216, 217 , 219, 220, 221, 221, 223, 223, 225, 225, 226, 227, 229, 229, 230, 230, 230, 231, 233, 235, 236, 236, 236, 236, 237, 238, 240, 241, 241, 241, 244,            242, 244, 245, 247, 247, 248, 248, 250, 250, 251, 252, 253, 254, 255, 255}; int[] MB = new int[] {1, 1, 3, 7, 9, 11, 12, 12, 16, 16, 18, 18, 21, 22, 24, 25, 26, 26, 27, 29, 31, 32, 33, 33, 35, 35, 38, 40, 41, 42, 43, 43, 46, 46, 47, 48, 50, 50, 52, 52, 54, 54, 55, 56, 60, 61, 63, 63, 65, 65, 66, 67, 68, 69 , 72, 73, 75, 77, 78, 79, 79, 81, 81, 82, 83, 85, 86, 87, 87, 89, 89, 89, 90, 92, 93, 94, 94, 96, 96, 97, 98, 100, 101  2, 102, 104, 104, 105, 106, 108, 109, 110, 110, 112, 112, 113, 114, 116, 117, 118, 118, 120, 120, 121, 122, 124, 125, 126, 126, 130, 130, 129, 130, 132, 133, 134, 134, 136, 136, 137, 138, 140, 141, 142, 142, 144, 144, 145, 146, 148, 149, 149, 1 49, 151, 151, 152, 153, 155, 156, 157, 157, 159, 159, 160, 161, 163, 164, 165, 165, 167, 167, 168, 169, 171, 172, 172, 172 , 172, 172, 174, 175, 177, 178, 179, 179, 180, 180, 181,182, 184, 185, 186, 186, 188, 188, 189, 189, 192, 193, 194, 194, 196, 196, 195, 195, 197, 198, 199, 199, 201, 201, 202, 20  3, 205, 206, 207, 207, 209, 209, 210, 211, 213, 214, 215, 215, 217, 217, 216, 217, 219, 220, 221, 221, 223, 223, 225, 225, 227, 228, 229, 229, 231, 231, 231, 232, 232, 234, 235, 235, 236, 236, 237, 238, 240, 241, 241, 242, 244, 243, 245, 246, 2            48, 248, 247, 247, 249, 249, 250, 251, 253, 254, 255, 255}; BitmapData srcdata = src.            LockBits (New Rectangle (0, 0, W, h), Imagelockmode.readwrite, Pixelformat.format24bpprgb);            byte* p = (byte*) srcdata.scan0;                    for (int y = 0, y < h; y++) {for (int x = 0; x < W; + +) {                    b = p[0];                    g = p[1];                    r = p[2];                    P[0] = (byte) mb[b];                    P[1] = (byte) mg[g];                    P[2] = (byte) mr[r];                p + = 3; } p + = Srcdata.stride-w * 3; } src.            Unlockbits (Srcdata);        return SRC; }    }}

Finally, put all the PS implementation and C # code implementation resources DOWNLOAD Link: http://download.csdn.net/detail/trent1985/8266331

Remember, what is the problem contact me Oh, my mailbox [email protected] , qq:1358009172

Image filter Art--Snow filter

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.