🍺 BREW Explorer

← all formulae

cgif

brew install cgif v0.5.3 MIT

Fast, lightweight C library for encoding GIF images and animations with color quantization and optimization.

Why you might care

Use cgif when you need to programmatically generate GIFs from C/C++ code without heavy dependencies. It's optimized for speed (1024×1024 GIFs in <50ms) and size, with features like transparency and frame-diff optimization useful for video-to-GIF conversion pipelines. A build/runtime dependency for media tools and image processing applications.

Categories

Alternatives

libgif ImageMagick ffmpeg
1.8k
30-day installs · #1016
7.5k
90-day · #925
21.7k
365-day · #1025
147
★ GitHub stars · updated 10d ago

Build dependencies

GitHub topics

animation c c99 compression encoder fast file-format gif gif89a graphics image library lightweight lzw picture size-optimization video

Links

Blurb generated by claude-haiku-4-5 on today.

Raw metadata
{
  "aliases": [],
  "alternatives": [
    "libgif",
    "ImageMagick",
    "ffmpeg"
  ],
  "build_dependencies": [
    "meson",
    "ninja"
  ],
  "categories": [
    "library",
    "image-tool"
  ],
  "caveats": null,
  "conflicts_with": [],
  "dependencies": [],
  "deprecated": 0,
  "deprecation_reason": null,
  "desc": "GIF encoder written in C",
  "disable_reason": null,
  "disabled": 0,
  "enrichment_fetched_at": "2026-06-20T23:36:17+00:00",
  "first_seen": "2026-06-20T23:34:18+00:00",
  "full_name": "cgif",
  "github_default_branch": "main",
  "github_last_commit_at": "2026-06-10T10:26:45Z",
  "github_readme_excerpt": "[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/cgif.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened\u0026can=1\u0026q=proj:cgif)\n## CGIF, a GIF encoder written in C\n\nA fast and lightweight GIF encoder that can create GIF animations and images. Summary of the main features:\n- user-defined global or local color-palette with up to 256 colors (limit of the GIF format)\n- True Color to GIF conversion (RGB/RGBA input) with quantization and dithering\n- size-optimizations for GIF animations:\n  - option to set a pixel to transparent if it has identical color in the previous frame (transparency optimization)\n  - do encoding just for the rectangular area that differs from the previous frame (width/height optimization)\n- fast: a GIF with 256 colors and 1024x1024 pixels can be created in below 50 ms even on a minimalistic system\n- MIT license (permissive)\n- different options for GIF animations: static image, N repetitions, infinite repetitions\n- additional source-code for verifying the encoder after making changes\n- user-defined delay time from one frame to the next (can be set independently for each frame)\n- stream-based output (via callback)\n- source-code conforms to the C99 standard\n\n## Examples\nTo get started, we suggest that you have a look at our code examples.\n- ```examples/cgif_example_video.c``` is an example that creates a GIF animation.\n- ```examples/cgif_example.c``` is an example for a static GIF image.\n- ```examples/cgif_rgb_example_video.c``` is an example that creates a GIF animation from RGB data.\n- ```examples/cgif_rgb_example.c``` is an example for a static GIF image from RGB data.\n\n## Overview\nTo get an overview of the API, we recommend having a look at our wiki (https://github.com/dloebl/cgif/wiki/General-API) where types and functions are described. The corresponding implementations can be found in ```src/cgif.c```, ```src/cgif_raw.c```, and ```src/cgif_rgb.c```. Here the most important types and functions:\n\n```C\n// Th",
  "github_repo": "dloebl/cgif",
  "github_stars": 147,
  "github_topics": [
    "animation",
    "c",
    "c99",
    "compression",
    "encoder",
    "fast",
    "file-format",
    "gif",
    "gif89a",
    "graphics",
    "image",
    "library",
    "lightweight",
    "lzw",
    "picture",
    "size-optimization",
    "video"
  ],
  "homepage": "https://github.com/dloebl/cgif",
  "homepage_og_description": null,
  "homepage_og_image": null,
  "homepage_title": null,
  "installs_30d": 1836,
  "installs_365d": 21679,
  "installs_90d": 7548,
  "keg_only": 0,
  "keg_only_reason": null,
  "last_seen": "2026-06-20T23:34:18+00:00",
  "license": "MIT",
  "llm_generated_at": "2026-06-20T23:48:27+00:00",
  "llm_model": "claude-haiku-4-5",
  "name": "cgif",
  "oldnames": [],
  "one_liner": "Fast, lightweight C library for encoding GIF images and animations with color quantization and optimization.",
  "optional_dependencies": [],
  "rank_30d": 1016,
  "rank_365d": 1025,
  "rank_90d": 925,
  "raw_hash": "be5816b138b2f967",
  "recommended_dependencies": [],
  "revision": 0,
  "ruby_source_path": "Formula/c/cgif.rb",
  "tap": "homebrew/core",
  "test_dependencies": [],
  "uses_from_macos": [],
  "version_head": null,
  "version_stable": "0.5.3",
  "versioned_formulae": [],
  "why_use_this": "Use cgif when you need to programmatically generate GIFs from C/C++ code without heavy dependencies. It\u0027s optimized for speed (1024\u00d71024 GIFs in \u003c50ms) and size, with features like transparency and frame-diff optimization useful for video-to-GIF conversion pipelines. A build/runtime dependency for media tools and image processing applications."
}