Skip to main content

A lightweight python tool for creating GIFs

Project description

gifing

A lightweight python tool for creating GIFs


from gifing import Gif

path = "tests/img"
file_path = [f"{path}/image{i}.jpg" for i in range(1, 4)]
gif = Gif(
    file_path,
    frame_duration=800,
    n_repeat_last_frame=3,
)
gif.set_labels(
    ["print", "hello", "world"],
    font_size=60,
    loc="bottom left",
    text_padding=40,
    box_padding=20,
    box_color="#fffcee",
    shadow_offset=15,
    font="Urbanist",
)
gif.set_background_color("red")
gif.set_size((900, 700), scale=1)
gif.make("img/output.gif")

This package offers:

  • a streamlined approach to creating GIFs
  • automatic image resizing
  • ability to set a background color during resizing
  • frame-by-frame label customization

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.10):

pip install git+https://github.com/JosephBARBIERDARNAL/gifing.git



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=1)  # Set the size to (300, 800) with no scaling

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

gif.make()

By default, the GIF will be saved as ./output.gif. You can customize the output path by passing it as an argument to the make() method.



License

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.0.tar.gz (5.1 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.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gifing-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 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.0.tar.gz
Algorithm Hash digest
SHA256 be5b2e38d3d570aeed0ef0a0708057e8559cb1d8b1b766ab2d2935834d543854
MD5 43a4179796e136eb2ba42fccd710e9ec
BLAKE2b-256 17f942cc7e8cfd26d96793d03ce7e8555b6f47bd1d7b836cee248d6c0c7bfd66

See more details on using hashes here.

Provenance

The following attestation bundles were made for gifing-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: gifing-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.7 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a05fea0c1bd24d834931f1ab2138b9c0786bae7544f9efaed34234970fa24eb6
MD5 2eca2db0912858c53d49ec1669213f3f
BLAKE2b-256 adee30e0a4023bf4d7f7623ec5e2d3dd32b81fdec7237d13fdca44d53fb8483c

See more details on using hashes here.

Provenance

The following attestation bundles were made for gifing-0.1.0-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