??? 作為第一篇文章,本人將介紹Instagram中Brannan 濾鏡的實現過程,當然,是自己的模擬而已,結果差異敬請諒解。
??? 先看下效果圖:


1 PS實現步驟:
1.1?打開測試圖像,復制圖層,命名為圖層a;
1.2?對圖層a進行去色操作,然后,打開色階-綠色-調整如下:

1.3對當前圖層a選擇圖層混合模式-濾色;
1.4新建圖層b,填充顏色RGB(36,1, 34),選擇圖層混合模式-柔光,不透明度60%:

1.5新建圖層c,填充顏色RGB(253,253,241),選擇圖層混合模式-正片疊底:
1.6合并所有圖層,即可得到相應的效果圖了;
2,程序實現:
~~~
<span style="font-size:14px;">public static Bitmap DoGrayEffect(Bitmap srcBitmap, int pxMode)
{
Bitmap src = new Bitmap(srcBitmap);
int w = src.Width;
int h = src.Height;
PixelFormat format = (pxMode == 0 ? PixelFormat.Format24bppRgb : PixelFormat.Format32bppArgb);
BitmapData srcData = src.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadWrite, format);
Desaturate((byte*)srcData.Scan0, w, h, srcData.Stride, pxMode);
src.UnlockBits(srcData);
return src;
}</span>
~~~
~~~
<span style="font-size:14px;"> //色階調整
public static Bitmap DoLevelAdjust(Bitmap srcBitmap, int DestChannel, int InputLeftLimit, int InputMiddle, int InputRightLimit, int OutputLeftLimit, int OutputRightLimit, int pxMode)
{
Bitmap src = new Bitmap(srcBitmap);
int w = src.Width;
int h = src.Height;
PixelFormat format = (pxMode == 0 ? PixelFormat.Format24bppRgb : PixelFormat.Format32bppArgb);
BitmapData srcData = src.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadWrite, format);
LevelAdjust((byte*)srcData.Scan0, w, h, srcData.Stride, DestChannel, InputLeftLimit, InputMiddle, InputRightLimit, OutputLeftLimit, OutputRightLimit, pxMode);
src.UnlockBits(srcData);
return src;
}</span>
~~~
~~~
<span style="font-size:14px;">//圖層混合模式
public static Bitmap DoEffect(Bitmap srcBitmap, Bitmap mxBitmap, int pxMode, int effectMode)
{
Bitmap src = new Bitmap(srcBitmap);
Bitmap mx = new Bitmap(mxBitmap);
int w = src.Width;
int h = src.Height;
PixelFormat format = (pxMode == 0 ? PixelFormat.Format24bppRgb : PixelFormat.Format32bppArgb);
BitmapData srcData = src.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadWrite, format);
BitmapData mxData = mx.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadWrite, format);
DoSpecialEffect((byte*)srcData.Scan0, (byte*)mxData.Scan0, w, h, srcData.Stride, pxMode, effectMode);
src.UnlockBits(srcData);
mx.UnlockBits(mxData);
return src;
}
//單色圖層混合模式
public static Bitmap DoSingleColorEffect(Bitmap srcBitmap, int r, int g, int b, int pxMode, int effectMode)
{
Bitmap src = new Bitmap(srcBitmap);
int w = src.Width;
int h = src.Height;
PixelFormat format = (pxMode == 0 ? PixelFormat.Format24bppRgb : PixelFormat.Format32bppArgb);
BitmapData srcData = src.LockBits(new Rectangle(0, 0, w, h), ImageLockMode.ReadWrite, format);
byte* p = (byte*)srcData.Scan0;
int seg = (pxMode == 0 ? 3 : 4);
for (int y = 0; y < h; y++)
{
for (int x = 0; x < w; x++)
{
DoPixelEffect(p, r, g, b, effectMode);
}
}
src.UnlockBits(srcData);
return src;
}</span>
~~~
~~~
<span style="font-size:14px;"> //Brannan 濾鏡
public static Bitmap BrannanFilter(Bitmap srcBitmap, int pxMode)
{
Bitmap temp = DoGrayEffect(srcBitmap, 0);//去色
Bitmap leBmp = DoLevelAdjust(temp, 2, 0, 128, 232, 0, 250, 0);//綠色色階調整
Bitmap filterBmp = DoEffect(srcBitmap, leBmp, 0, (int)EffectMode.MODE_FILTERCOLOR);//濾色
temp = DoSingleColorEffect(filterBmp, 22, 1, 20, 0, (int)EffectMode.MODE_SMOOTHLIGHT);//柔化
temp = DoSingleColorEffect(temp, 253, 253, 241, 0, (int)EffectMode.MODE_MULTIPLY);//正片疊底
return temp;
}</span>
~~~
PSD文件及C代碼DEMO免費下載鏈接:[點擊打開鏈接](http://download.csdn.net/detail/trent1985/8055639)
**最后,分享一個專業的圖像處理網站(微像素),里面有很多源代碼下載:**
[http://www.zealpixel.com/portal.php](http://www.zealpixel.com/portal.php)
- 前言
- 序言
- Brannan濾鏡
- 編碼基礎(Photoshop基礎變換的代碼實現)
- Toaster濾鏡
- Hudson濾鏡(Instagram)
- 暴雨濾鏡
- 大雪濾鏡
- 圖像濾鏡實現萬能方法研究
- 大霧效果濾鏡
- 連環畫濾鏡
- 暗調濾鏡
- 懷舊風格濾鏡
- (Nostalgla Filter)老照片濾鏡
- (Punch Filter)交叉沖印濾鏡
- (Lightleaks Filter)漏光濾鏡
- 漫畫濾鏡
- LOMO Filter
- Glow Filter發光濾鏡
- (Instagram)1977濾鏡
- (Sketch Filter)素描濾鏡
- 水彩畫濾鏡
- 圖像光照效果濾鏡
- Oilpaint油畫濾鏡
- Swirl濾鏡
- Wave濾鏡
- 球面(Spherize)濾鏡
- 擠壓(Pinch)濾鏡
- 旋轉模糊濾鏡
- 霓虹、浮雕、木刻濾鏡
- 圖像濾鏡暈影調節算法研究
- PS平均(濾鏡-模糊-平均)效果
- Photoshop實現Instagram Amaro濾鏡特效
- Photoshop實現Instagram之Nashville濾鏡
- Photoshop實現Instagram之Sierra濾鏡
- Photoshop實現Instagram之Mayfair濾鏡效果
- ZPhotoEngine超級算法庫
- 樂高像素拼圖特效
- 樂高像素拼圖特效濾鏡的代碼實現
- 保留細節的磨皮濾鏡之PS實現
- 保留細節的磨皮之C#程序實現
- 流行藝術風濾鏡特效PS實現
- PS圖層混合模式之明度模式