Files
gif-resizer/GifResizer/Service/GifService.cs
2026-02-17 18:31:42 +01:00

28 lines
732 B
C#

using System.IO;
using GifResizer.Models;
namespace GifResizer.Service;
public class GifService
{
public GifService()
{
}
public GifData GetData(string filePath)
{
return new GifData(filePath);
}
public void ResizeGif(string filePath, int width, int height)
{
string downloadsFolder = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");
string fileName = Path.GetFileNameWithoutExtension(filePath);
using Gif gif = new Gif(filePath);
gif.Load();
gif.Resize(width, height);
gif.Save(Path.Combine(downloadsFolder, "gif-resizer", fileName, $"{fileName}-{width}x{height}.gif"));
}
}