Skip to content
Snippets Groups Projects
Commit d908f2d3 authored by Riley Mcgee's avatar Riley Mcgee
Browse files

Merge branch 'SaveGIF'

parents caeaa3c5 0b60514a
No related branches found
No related tags found
No related merge requests found
...@@ -70,17 +70,23 @@ namespace Gifitti.Models ...@@ -70,17 +70,23 @@ namespace Gifitti.Models
public void saveGif(string path) public void saveGif(string path)
{ {
//Error Handel on path //Error Handel on path
Regex savePathTest = new Regex(@"^(([^\/\\]+)[\/\\])*([^\/\\]*)\.[g|G][i|I][f|F]$");
if (!savePathTest.IsMatch(path)) //RE for path with extension
Regex extensionTester = new Regex(@"^.*\.[g|G][i|I][f|F]$");
//RE for path without extension
Regex savePathTester = new Regex(@"^(([^\/\\]+)[\/\\])*([^\/\\]*)");
if (!savePathTester.IsMatch(path))
{ {
throw new DirectoryNotFoundException(); throw new DirectoryNotFoundException();
} }
//Handel non gif extensions
if (!extensionTester.IsMatch(path))
path += ".gif";
//TODO take in image setting components as well as frames being viewed etc. //TODO take in image setting components as well as frames being viewed etc.
//Build GIF //Build GIF
using (MagickImageCollection collection = new MagickImageCollection()) using (MagickImageCollection collection = new MagickImageCollection())
{ {
for (int i = 0; i < frames.Length; i++) for (int i = this.startFrame; i < Math.Min(this.endFrame, frames.Length); i++)
collection.Add(new MagickImage(frames[i] as Bitmap)); collection.Add(new MagickImage(frames[i] as Bitmap));
// Maximize Colour saturation // Maximize Colour saturation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment