28 lines
683 B
C#
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; }
|
|
} |