| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3203 人关注过本帖, 1 人收藏
标题:如何制作会动的图片保存为gif等图片格式
只看楼主 加入收藏
哦是菜鸟
Rank: 2
等 级:论坛游民
帖 子:40
专家分:15
注 册:2011-9-14
结帖率:87.5%
收藏(1)
已结贴  问题点数:20 回复次数:8 
如何制作会动的图片保存为gif等图片格式
如何制作会动的图片保存为gif等图片格式
搜索更多相关主题的帖子: 如何 会动的图片 制作 
2011-09-26 10:20
yinniannian
Rank: 9Rank: 9Rank: 9
来 自:河北省石家庄
等 级:蜘蛛侠
威 望:2
帖 子:256
专家分:1007
注 册:2011-5-13
收藏
得分:4 
flash

代做小型软件。
QQ:449795473
2011-09-26 10:52
哦是菜鸟
Rank: 2
等 级:论坛游民
帖 子:40
专家分:15
注 册:2011-9-14
收藏
得分:0 
回复 2楼 yinniannian
哦说的是C#如何制作会动的图片保存为gif等图片格式

2011-09-26 11:13
fily1314
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
帖 子:166
专家分:1190
注 册:2007-7-18
收藏
得分:4 
以前用过一个把其他图片合成一个gif图片的工具
好像叫gifMaker什么的  不大记得了
2011-09-26 11:15
哦是菜鸟
Rank: 2
等 级:论坛游民
帖 子:40
专家分:15
注 册:2011-9-14
收藏
得分:0 
菜鸟终于找到相关内容了大家研究研究如何制作保存gif
private void SetGifBackground(string gifPath)
        {
            Image gif = Image.FromFile(gifPath);
            System.Drawing.Imaging.FrameDimension fd = new System.Drawing.Imaging.FrameDimension(gif.FrameDimensionsList[0]);
            int count = gif.GetFrameCount(fd);    //获取帧数(gif图片可能包含多帧,其它格式图片一般仅一帧)
            Timer giftimer = new Timer();
            giftimer.Interval = 100;
            int i = 0;
            Image bgImg = null;
            giftimer.Tick += (s, e) => {
                if (i >= count) { i = 0; }
                gif.SelectActiveFrame(fd, i);
                stream = new ();
                gif.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
                if (bgImg != null) { bgImg.Dispose(); }
                bgImg = Image.FromStream(stream);
                this.BackgroundImage = bgImg;
                i++;
            };
            giftimer.Start();
        }

2011-09-26 11:24
贺增辉
Rank: 1
等 级:新手上路
帖 子:1
专家分:4
注 册:2011-9-27
收藏
得分:4 
学习 学习了···
2011-09-27 09:15
xsdexiaoge
Rank: 1
等 级:新手上路
帖 子:1
专家分:4
注 册:2011-9-27
收藏
得分:4 
什么都没有啊
2011-09-27 16:39
哦是菜鸟
Rank: 2
等 级:论坛游民
帖 子:40
专家分:15
注 册:2011-9-14
收藏
得分:0 
http://blog.
2011-09-29 10:57
哦是菜鸟
Rank: 2
等 级:论坛游民
帖 子:40
专家分:15
注 册:2011-9-14
收藏
得分:0 
合成GIF

/* create Gif */
//you should replace filepath
String [] imageFilePaths = new String[]{"c:\\01.png","c:\\02.png","c:\\03.png"};
String outputFilePath = "c:\\test.gif";
AnimatedGifEncoder e = new AnimatedGifEncoder();
e.Start( outputFilePath );
e.SetDelay(500);
//-1:no repeat,0:always repeat
e.SetRepeat(0);
for (int i = 0, count = imageFilePaths.Length; i < count; i++ )
{
    e.AddFrame( Image.FromFile( imageFilePaths[i] ) );
}
e.Finish();
/* extract Gif */
string outputPath = "c:\\";
GifDecoder gifDecoder = new GifDecoder();
gifDecoder.Read( "c:\\test.gif" );
for ( int i = 0, count = gifDecoder.GetFrameCount(); i < count; i++ )
{
    Image frame = gifDecoder.GetFrame( i ); // frame i
    frame.Save( outputPath + Guid.NewGuid().ToString() + ".png", ImageFormat.Png );
}

分解GIF

using System.Drawing.Drawing2D;
using System.Drawing.Imaging;

Image imgGif = Image.FromFile(@"d:\test.gif");
//Create a new FrameDimension object from this image
FrameDimension ImgFrmDim = new FrameDimension( imgGif.FrameDimensionsList[0] );

//Determine the number of frames in the image
//Note that all images contain at least 1 frame,
//but an animated GIF will contain more than 1 frame.

int nFrameCount = imgGif.GetFrameCount( ImgFrmDim );

// Save every frame into jpeg format
for( int i = 0; i < nFrameCount; i++ )
{
    imgGif.SelectActiveFrame( ImgFrmDim, i );
    imgGif.Save( string.Format( @"d:\Frame{0}.jpg", i ), ImageFormat.Jpeg );
}

搞定
2011-09-29 13:00
快速回复:如何制作会动的图片保存为gif等图片格式
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018306 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved