校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

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

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

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

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)構(gòu)建LINQ查詢表達式
  • 詳解c# 協(xié)變和逆變
  • c# 播放聲音的四種方法
  • C#實現(xiàn)窗體抖動的兩種方法
  • c# 制作gif的四種方法

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

巨人網(wǎng)絡(luò)通訊聲明:本文標題《.net c# gif動畫如何添加圖片水印實現(xiàn)思路及代碼》,本文關(guān)鍵詞  .net,gif,動畫,如何,添加,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《.net c# gif動畫如何添加圖片水印實現(xiàn)思路及代碼》相關(guān)的同類信息!
  • 本頁收集關(guān)于.net c# gif動畫如何添加圖片水印實現(xiàn)思路及代碼的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 榆中县| 嫩江县| 新宁县| 邳州市| 日喀则市| 左贡县| 永泰县| 张家港市| 巴彦淖尔市| 桑植县| 东乡族自治县| 清水河县| 淄博市| 星座| 宁晋县| 错那县| 怀宁县| 青海省| 滕州市| 治县。| 长兴县| 虞城县| 彝良县| 易门县| 肃南| 斗六市| 娱乐| 夹江县| 孟州市| 永川市| 车险| 双峰县| 永定县| 斗六市| 江西省| 宜宾县| 沙田区| 包头市| 祁门县| 邵阳市| 伊宁市|