Skip to content
프로젝트

소개

이미지 데이터로 애니메이션 GIF를 생성하는 간단한 C++ 단일 헤더 라이브러리입니다.

디자인 및 미디어

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
+1
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

gif-h

This one-header library offers a simple, very limited way to create animated GIFs directly in code. Those looking for particular cleverness are likely to be disappointed; it's pretty much a straight-ahead implementation of the GIF format with optional Floyd-Steinberg dithering. (It does at least use delta encoding - only the changed portions of each frame are saved.)

So resulting files are often quite large. The hope is that it will be handy nonetheless as a quick and easily-integrated way for programs to spit out animations.

Only RGBA8 is currently supported as an input format. (The alpha is ignored.)

Email me : ctangora -at- gmail -dot- com

Usage:

Create a GifWriter struct.

Pass the struct to GifBegin() to initialize values and write the file header.

Pass frames of the animation to GifWriteFrame().

Finally, call GifEnd() to close the file handle and free memory.

#include <vector>
#include <cstdint>
#include <gif.h>
int main()
{
	int width = 100;
	int height = 200;
	std::vector<uint8_t> black(width * height * 4, 0);
	std::vector<uint8_t> white(width * height * 4, 255);

	auto fileName = "bwgif.gif";
	int delay = 100;
	GifWriter g;
	GifBegin(&g, fileName, width, height, delay);
	GifWriteFrame(&g, black.data(), width, height, delay);
	GifWriteFrame(&g, white.data(), width, height, delay);
	GifEnd(&g);

	return 0;
}

관련 프로젝트 살펴보기

불러오는 중…