婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁 > 知識庫 > .net c# gif動畫如何添加圖片水印實現(xiàn)思路及代碼

.net c# gif動畫如何添加圖片水印實現(xiàn)思路及代碼

熱門標簽:內(nèi)蒙古智能電銷機器人哪家強 濟源人工智能電話機器人價格 百度地圖標注點擊事件 泰州手機外呼系統(tǒng)軟件 怎樣在地圖標注消火栓圖形 杭州智能電話機器人 山東防封電銷卡辦理套餐 廈門四川外呼系統(tǒng) 地圖標注位置多的錢
復制代碼 代碼如下:

public static Bitmap WaterMarkWithText(System.Drawing.Bitmap origialGif, string
text,string filePath)
{
//用于存放楨
ListFrame> frames = new
ListFrame>();
//如果不是gif文件,直接返回原圖像
if (origialGif.RawFormat.Guid
!= System.Drawing.Imaging.ImageFormat.Gif.Guid)
{
return origialGif;

}
//如果該圖像是gif文件
foreach (Guid guid in
origialGif.FrameDimensionsList)
{
System.Drawing.Imaging.FrameDimension
frameDimension = new System.Drawing.Imaging.FrameDimension(guid);
int
frameCount = origialGif.GetFrameCount(frameDimension);
for (int i = 0; i
frameCount; i++)
{
if (origialGif.SelectActiveFrame(frameDimension,
i) == 0)
{
int delay =
Convert.ToInt32(origialGif.GetPropertyItem(20736).Value.GetValue(i));
Image
img = Image.FromHbitmap(origialGif.GetHbitmap());
Font font = new Font(new
FontFamily("宋體"), 35.0f,FontStyle.Bold);
Graphics g =
Graphics.FromImage(img);
g.DrawString(text, font, Brushes.BlanchedAlmond,
new PointF(10.0f, 10.0f));
Frame frame = new Frame(img, delay);

frames.Add(frame);
}
}
Gif.Components.AnimatedGifEncoder gif =
new Gif.Components.AnimatedGifEncoder();
gif.Start(filePath);

gif.SetDelay(100);
gif.SetRepeat(0);
for (int i = 0; i
frames.Count; i++)
{
gif.AddFrame(frames[i].Image);
}

gif.Finish();
try
{
Bitmap gifImg =
(Bitmap)Bitmap.FromFile(filePath);
return gifImg;
}
catch
{

return origialGif;
}
}
return origialGif;
}
您可能感興趣的文章:
  • C#判斷一個圖像是否是透明的GIF圖的方法
  • C#中使用UDP通信的示例
  • c# 獲取照片的經(jīng)緯度和時間的示例代碼
  • 大白話講解C# 中的委托
  • C#中Write()和WriteLine()的區(qū)別分析
  • c# 動態(tài)構建LINQ查詢表達式
  • 詳解c# 協(xié)變和逆變
  • c# 播放聲音的四種方法
  • C#實現(xiàn)窗體抖動的兩種方法
  • c# 制作gif的四種方法

標簽:喀什 朔州 朝陽 周口 百色 臺州 新鄉(xiāng) 洛陽

巨人網(wǎng)絡通訊聲明:本文標題《.net c# gif動畫如何添加圖片水印實現(xiàn)思路及代碼》,本文關鍵詞  .net,gif,動畫,如何,添加,;如發(fā)現(xiàn)本文內(nèi)容存在版權問題,煩請?zhí)峁┫嚓P信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《.net c# gif動畫如何添加圖片水印實現(xiàn)思路及代碼》相關的同類信息!
  • 本頁收集關于.net c# gif動畫如何添加圖片水印實現(xiàn)思路及代碼的相關信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 台南县| 珲春市| 东丽区| 琼中| 藁城市| 宁海县| 大邑县| 临西县| 黄浦区| 东方市| 霍邱县| 崇州市| 华安县| 南通市| 陆河县| 文水县| 桂林市| 浙江省| 剑川县| 鲁山县| 汽车| 海盐县| 云和县| 隆子县| 鞍山市| 张家川| 峡江县| 紫云| 兰州市| 辉县市| 靖宇县| 依安县| 武汉市| 塘沽区| 襄垣县| 崇左市| 宜川县| 甘谷县| 霍林郭勒市| 左云县| 宁乡县|