gif图像分解、gif图像制作
1、gif图像分解:
gifTool.exe 工具下载
2、gif图像制作:
3、工具核心源码:
点击下载
using Gif.Components;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace Tool
{/// <summary>/// gif图像处理类/// /// gif图像分解: SaveSubImage()/// 合并为gif图像: SaveToGif()/// </summary>public class GifTools{/// <summary>/// 自动处理函数;/// 获取所有gif图像的子图;/// 或合并所有图像为单个gif图像;/// </summary>public static void AutoProcess(string[] files){List<string> gifList = new List<string>();List<string> picList = new List<string>();foreach (string file in files){if(file.ToLower().EndsWith(".gif")) gifList.Add(file);else picList.Add(file);}// 获取所有gif的子图像foreach (string gif in gifList) GifTools.SaveSubImage(gif);// 合并所有图像为单个gif图像GifTools.SaveToGif(picList.ToArray());}/// <summary>/// 获取gif图像的所有子图像,保存到gifPath所在路径/// </summary>public static void SaveSubImage(string gifPath){Image imgGif = Image.FromFile(gifPath, true);SaveSubImage(imgGif, gifPath);imgGif.Dispose();}/// <summary>/// 获取imgGif的所有子图像,保存到savePath对应的路径/// </summary>public static void SaveSubImage(Image imgGif, string savePath){//Create a new FrameDimension object from this imagevar 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 n = imgGif.GetFrameCount(ImgFrmDim); // 获取子图像数目// Save every frame into png format filefor (int i = 0; i < n; i++){imgGif.SelectActiveFrame(ImgFrmDim, i); // 选择子图string newName = savePath;if (newName.Contains(".")) newName = newName.Substring(0, newName.LastIndexOf("."));newName = newName + "_" + i + ".png";imgGif.Save(newName, ImageFormat.Png); // 保存}}/// <summary>/// 保存多张图像为单张gif图像/// </summary>public static void SaveToGif(string[] imagePaths, string outputFilePath="", int ms = 100, bool repet = true){List<Image> list = new List<Image>();foreach (string path in imagePaths){list.Add(Image.FromFile(path));}if (outputFilePath.Equals("")){// 设置输出文件名outputFilePath = imagePaths[0];if (outputFilePath.Contains(".")) outputFilePath = outputFilePath.Substring(0, outputFilePath.LastIndexOf("."));outputFilePath = outputFilePath + ".gif";}SaveToGif(list.ToArray(), outputFilePath, ms, repet);foreach (Image image in list) image.Dispose();}/// <summary>/// 保存多张图像为单张gif图像/// </summary>public static void SaveToGif(Image[] images, string outputFilePath, int ms = 100, bool repet = true){AnimatedGifEncoder encoder = new AnimatedGifEncoder();encoder.Start(outputFilePath); // 输出gif文件路径encoder.SetDelay(ms); // 帧间隔encoder.SetRepeat(repet ? 0 : -1); // 0:循环 -1:不循环for (int i = 0, count = images.Length; i < count; i++){encoder.AddFrame(images[i]); // 添加图像}encoder.Finish();}}
}
gif图像分解、gif图像制作相关推荐
- 基于C++的本征图像分解(Intrinsic Image Decomposition)
利用本征图像分解(Intrinsic Image Decomposition)算法,将图像分解为shading(illumination) image 和 reflectance(albedo) im ...
- 小波图像分解与重构程序存在的问题与解决办法
(思远老师的好文章留着) 转载自http://blog.csdn.net/chenyusiyuan/article/details/2513126 去年11月发布了一系列有关小波变换和图像处理的文章, ...
- 【论文笔记】—本征图像分解—Unsupervised—USI^3^D—2020-CVPR
[论文介绍] 提出了第一个基于物理的单图像无监督学习用于本征图像分解网络USI3D(Unsupervised Single Image Decomposition) 本征图像,是指将一幅图像分解成两个 ...
- 本征图像分解:Retinex理论【转载】
本征图像分解:Retinex理论 鲜橙关注 0.1742019.07.29 00:42:51字数 1,504阅读 2,531 我们通过眼睛观察到或者相机拍摄到的物体颜色主要由两方面因素决定,第一是物体 ...
- Lytro Illum光场图像分解的白图像
第一篇博客,说一下之前遇到的一个弄了蛮久的小问题. 之前为了使用LFToolbox0.4来分解Illum相机拍摄的光场图片,在网上找了一番资料.了解到,分解中用于标定的whiteimages在Illu ...
- 【转】小波图像分解与重构
原文地址:[转]小波图像分解与重构 作者:freedesert 小波图像融合综述(1) 分类: 小波变换 2007-11-14 11:15 4728人阅读 评论(6) 收藏 举报 图像融合是将 ...
- OpenCV精进之路(十六):图像分解和融合技术——图像拼接和图像融合技术
图像拼接在实际的应用场景很广,比如无人机航拍,遥感图像等等,图像拼接是进一步做图像理解基础步骤,拼接效果的好坏直接影响接下来的工作,所以一个好的图像拼接算法非常重要. 再举一个身边的例子吧,你用你的手 ...
- cad放大_如何在CAD中对图像分解成线
下面我们就来看看如何在CAD中怎么把JPG图片插入页面中,并把图片中的图形做出线描的效果呢?这里我们用到CAD编辑工具来对此项功能以演示. 方法/步骤 首先我们要在电脑中安装CAD编辑工具来实现此操作 ...
- 图像分解python_将图像等分为两部分python open
您可以将图像的顶部和底部水平裁剪到中间. 打开图像.import cv2 import numpy as np image = cv2.imread('images/blobs1.png') cv2. ...
最新文章
- 【Vista中系统准备工具存在隐患,自动清除用户资料】
- 2009年EI(美国工程索引)收录的中国期刊
- 政策推动加速5G发展 全球统一标准成大势所趋
- java面试题24 关于Java中的数组,
- 从运维角度浅谈MySQL数据库优化,中小企业DBA必会
- 闪耀超颖光栅的建模与设计
- 51单片机教室人数进出统计检测数码管显示装置红外传感器
- xp系统计算机怎么设置权限设置,xp系统共享权限如何设置|xp系统共享权限设置方法...
- json数据快速格式化
- deepin深度系统下安装QQ音乐
- 【1.7k行代码优秀课设】基于stm32f4xx粤嵌GEC-M4的按键密码锁、呼吸灯、蜂鸣器音乐、超声波测距及倒车雷达、温湿度检测、光敏电阻自动灯光调节、USART串口控制系统
- 数据库死锁的预防与解除
- 一招教你如何在简历上突出工作经验!(干货)
- 物联网信号测试软件,物联网开关量信号采集 NPN转WIFI 检测计数器
- 浅谈Redis数据类型
- 【程序源代码】微信小程序餐饮点餐商城
- 【全国大学生电子设计大赛】2021-04-26
- 弟兄胜过他,因为羔羊的血
- logits and labels must be broadcastable: logits_size=[131072,9] labels_size=[131072,8]的错误
- 搞清线程池的几种实现方式