Openize.Animated-GIF-SDK for .NET
Openize.Animated-GIF를 사용하여 .NET에서 GIF 애니메이션 생성 및 편집
프레임, 색상, 재생 설정을 정확히 제어하여 GIF 애니메이션을 생성 및 디코딩하기 위한 C# 경량 라이브러리.
Openize.Animated-GIF for .NET는 GIF 애니메이션을 생성하고 처리하기 위해 설계된 .NET용 경량 오픈 소스 라이브러리입니다. 이 인기 있는 animated-gif-lib-for-java의 C# 버전은 고급 색 양자화, 투명성 제어 및 프레임 관리를 포함한 기능을 갖춘 GIF 인코딩 및 디코딩을 강력하게 지원합니다.
NuGet을 통한 설치는 간단하며, 개발자는 GIF 생성 및 처리 기능을 .NET 애플리케이션에 쉽게 통합할 수 있습니다. Openize.Animated-GIF는 이미지 시퀀스에서 GIF 애니메이션을 생성하고, 기존 GIF에서 프레임 및 메타데이터를 추출하며, 프레임 지연, 루프 횟수 및 삭제 방법과 같은 애니메이션 매개변수를 조정하는 데 필요한 도구를 제공합니다.
이 오픈 소스 SDK를 개선하기 위해 기여하거나 개선 사항을 제안하거나 GitHub 리포지토리를 탐색하세요: https://github.com/openize-com/openize-animated-gif-net
Openize.Animated-GIF for .NET 시작하기
Openize.Animated-GIF for .NET을 설치하는 권장 방법은 NuGet을 사용하는 것입니다. 다음 명령을 사용하여 원활하게 설치하세요.
설치
dotnet add package Openize.Animated.GIF
또는 NuGet 패키지 관리자 사용:
Install-Package Openize.Animated.GIF
빠른 시작
다음 코드 스니펫은 Openize.Animated-GIF for .NET을 사용하여 GIF 애니메이션을 생성하고 읽는 방법을 보여줍니다.
.NET SDK를 사용하여 GIF 애니메이션 생성
using Openize.Animated-GIF; using System.Drawing;
// Initialize the encoder
var encoder = new AnimatedGifEncoder();
encoder.Start("output.gif");
// Configure animation settings
encoder.SetDelay(500); // 500ms between frames
encoder.SetRepeat(0); // Loop infinitely
// Add frames
encoder.AddFrame(new Bitmap("frame1.png"));
encoder.AddFrame(new Bitmap("frame2.png"));
// Finish encoding
encoder.Finish();
GIF 애니메이션 읽기
// Initialize the decoder
var decoder = new GifDecoder();
decoder.Read("input.gif");
// Get information
int frameCount = decoder.GetFrameCount();
int loopCount = decoder.GetLoopCount(); // 0 = infinite
// Extract frames
for (int i = 0; i < frameCount; i++)
{
Bitmap frame = decoder.GetFrame(i);
frame.Save($"frame_{i}.png");
}
고급 옵션
// Configure transparency
encoder.SetTransparent(Color.White, true); // Exact match
// Set specific background color
encoder.SetBackground(Color.Black);
// Custom size (for oversized images)
encoder.SetSize(800, 600);