Skip to main content

A lightweight python tool for creating GIF

Project description

gifing

A lightweight python tool for creating GIF


Quick start

Let's make a GIF with these images:

from gifing import GIF

path = "tests/img/image"
path_to_files = [f"{path}1.jpg", f"{path}2.jpg", f"{path}3.jpg",]

gif = GIF(
  path_to_files,
  frame_duration=500,      # in ms
  n_repeat_last_frame=3,   # 500x3
)
gif.set_background_color("red")
gif.set_size((900, 700), scale=1.2)
gif.make("img/output.gif")

This package offers:

  • a streamlined approach to creating GIF
  • automatic image resizing
  • ability to set a background color during resizing

It's a basic prototype of the functionality I envision for this tool. The API is still unstable.


Installation

Install directly via pip (requires Python >=3.9):

pip install gifing



Usage

Import the GIF class and provide a list of image file paths:

from gifing import GIF

path = "tests/img"
gif = GIF(
    [f"{path}/image{i}.jpg" for i in range(1, 4)],
    frame_duration=800,  # Duration per frame (in milliseconds)
    n_repeat_last_frame=3,  # Repeat last frame 3x longer
)

You can set a background color, which is useful if your images have varying sizes:

gif.set_background_color("black")

You can also set a custom size for your GIF. The set_size method allows you to specify a target size and scale factor:

gif.set_size((300, 800), scale=2) # (600px, 1600px)

Finally, call the make() method to generate the GIF:

gif.make("path/to/output/file.gif")

If not specified, by default, the GIF will be saved as output.gif.

Project details


Download files

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

Source Distribution

gifing-0.1.1.tar.gz (5.4 MB view details)

Uploaded Source

Built Distribution

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

gifing-0.1.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file gifing-0.1.1.tar.gz.

File metadata

  • Download URL: gifing-0.1.1.tar.gz
  • Upload date:
  • Size: 5.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gifing-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4d9aec2bd033f913c81a2cc34acd778f8ddb151cc48f6f6fb7c110508178fb5d
MD5 a76d1714cd9d0e05f9247ff2a5f91550
BLAKE2b-256 990fcec460def26d663e624efb117a10478adbd01edd889d1f5e704b530db394

See more details on using hashes here.

Provenance

The following attestation bundles were made for gifing-0.1.1.tar.gz:

Publisher: pypi.yaml on y-sunflower/gifing

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gifing-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: gifing-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for gifing-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7eca76587dfcfc2ff449b4a56c5f663b3a389c1d67afc43aceceb4b803931c0f
MD5 d7fd3a020c148f8dab849524febc6606
BLAKE2b-256 7be312bc273cbe9001c355514040a00e7842fad112f55f95737b5f691b70df3b

See more details on using hashes here.

Provenance

The following attestation bundles were made for gifing-0.1.1-py3-none-any.whl:

Publisher: pypi.yaml on y-sunflower/gifing

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page