Implemented gif exportation and added some style (again)
This commit is contained in:
29
GifResizer/Models/GifData.cs
Normal file
29
GifResizer/Models/GifData.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.IO;
|
||||
using SixLabors.ImageSharp;
|
||||
|
||||
namespace GifResizer.Models;
|
||||
|
||||
public class GifData
|
||||
{
|
||||
public GifData(string path)
|
||||
{
|
||||
Load(path);
|
||||
}
|
||||
|
||||
private void Load(string path)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(path);
|
||||
if (path.Length == 0 || path.IsWhiteSpace() || !File.Exists(path))
|
||||
throw new ArgumentException($"File '{path}' does not exist");
|
||||
|
||||
using Image image = Image.Load(path);
|
||||
Path = path;
|
||||
Width = image.Width;
|
||||
Height = image.Height;
|
||||
}
|
||||
|
||||
public string Path { get; private set; }
|
||||
public int Width { get; private set; }
|
||||
public int Height { get; private set; }
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user