Skip to main content

gif-resizer

Scale and crop animated GIFs to an exact pixel size. Made for LED matrix panels like 128x32 or 192x32 but it works for whatever fixed size you need. It wraps ffmpeg under the hood so every frame gets resized in one go and you never have to touch a single frame by hand.

before after (-s 128x32 --fit contain)
original duck gif resized duck gif

Install

You need ffmpeg on your PATH. On macOS just run brew install ffmpeg.

pip install gif-resizer

Usage

# Scale to fill 128x32 and crop whatever overflows (default)
gif-resizer input.gif -s 128x32

# Scale to fit inside 192x32 and pad the rest with black
gif-resizer input.gif -s 192x32 --fit contain

# Crop pinned to the top instead of centered
gif-resizer input.gif -s 128x32 --gravity top

# Batch resize a folder
gif-resizer *.gif -s 128x32 -o resized/

The output is fully opaque by default. Any transparency in the source (and any padding added by --fit contain) gets flattened onto --background black. This is on purpose since a lot of simple GIF decoders (LED matrix controllers included) don't really handle GIF transparency right so baking in a solid color just works everywhere. Pass --background transparent if you know your target can handle alpha.

There's also support for different gravity fit and fps settings. Run gif-resizer --help to see everything it can do.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gif_resizer-0.1.0.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gif_resizer-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file gif_resizer-0.1.0.tar.gz.

File metadata

  • Download URL: gif_resizer-0.1.0.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gif_resizer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 70192ef8a8c949edd7694c681bca1069695d04eb5778028774238a5c5412b65f
MD5 0fc7d8f608b83aae3a88cce4e7d97279
BLAKE2b-256 24a49eaa158cb5de03721eaf86e0fb39d42a1ad232a1a0033ffaf1e8deb8cbec

See more details on using hashes here.

File details

Details for the file gif_resizer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gif_resizer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gif_resizer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f984ad685ce3d920f7b16de769feb0f10379847fe12b4645a9228509eb2ecef
MD5 6c0d15e5d96dbdc8775db721e9c32054
BLAKE2b-256 cc204b87bee5395eb511893170b8cf9d6f8cf8a1140aa204f136cf91b441bcec

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page