Files
gif-resizer/GifResizer/Models/GifData.cs
2026-02-17 19:38:16 +01:00

28 lines
683 B
C#

using System.IO;
using ImageMagick;
namespace GifResizer.Models;
public class GifData
{
public GifData(string path)
{
Load(path);
}
private void Load(string path)
{
ArgumentNullException.ThrowIfNull(path);
if (string.IsNullOrWhiteSpace(path) || !File.Exists(path))
throw new ArgumentException($"File '{path}' does not exist");
using var image = new MagickImage(path);
Path = path;
Width = (int)image.Width;
Height = (int)image.Height;
}
public string Path { get; private set; }
public int Width { get; private set; }
public int Height { get; private set; }
}