gif-to-livephoto
GIF to Live Photo — free browser tool for converting GIFs to iPhone Live Photos (the reference UI for this library).
Offline Python library for converting animated GIFs into iPhone-usable Live Photo packages (.livp).
Package: gif-to-livephoto on PyPI (0.1.0).
Install
pip install gif-to-livephoto
System requirements
| Dependency | Required? | Purpose |
|---|---|---|
| ffmpeg | Yes | Encodes the GIF as H.264 MOV and extracts the JPEG still. Must be on PATH. |
| libheif | No | Not used. This library writes a JPEG still, not HEIC. |
Install ffmpeg:
- macOS:
brew install ffmpeg - Ubuntu/Debian:
sudo apt-get install ffmpeg - Windows: download from ffmpeg.org
If ffmpeg is missing, the library raises FFmpegNotFoundError with install hints.
gif-to-livephoto --check
Quick start
from gif_to_livephoto import convert_gif_to_livephoto
# Write a .livp file
convert_gif_to_livephoto("animation.gif", "output.livp")
# Or get bytes
livp_bytes = convert_gif_to_livephoto("animation.gif")
API
Convenience function
| Function | Role |
|---|---|
convert_gif_to_livephoto(gif_source, output_path=None, max_duration=3.0, quality=23) |
Convert a GIF path/bytes/file object to .livp (returns bytes when output_path is None) |
Class API
| Method | Description |
|---|---|
GifToLivePhoto(gif_source) |
Load GIF from path, bytes, or file-like object |
.convert(output_path=None, max_duration=3.0, quality=23) |
Convert; write file or return bytes |
.to_bytes(max_duration=3.0, quality=23) |
Convert and return .livp bytes |
.get_asset_id() |
UUID pairing still + movie (after convert) |
.get_video_preview() |
Raw MOV bytes before metadata injection |
.get_still_preview() |
Raw JPEG bytes before metadata injection |
Errors
| Exception | When |
|---|---|
FFmpegNotFoundError |
ffmpeg is not on PATH |
FFmpegError |
ffmpeg ran but encoding/extraction failed |
CLI
gif-to-livephoto input.gif output.livp
gif-to-livephoto animation.gif # writes animation.livp
gif-to-livephoto input.gif -d 5.0 -q 20
gif-to-livephoto --check
Live Photo / .livp format
A .livp file is a ZIP (store/no compression) containing a paired still + video:
| Entry | Role |
|---|---|
IMG_0001.JPG |
Still image. Exif MakerNote (Apple iOS) holds the Live Photo asset identifier (UUID). Taken from the first GIF frame. |
IMG_0001.MOV |
H.264 movie (yuv420p, even dimensions, no audio). QuickTime metadata carries the same asset identifier plus a still-image-time track that marks the still frame. |
Photos pairs the two files via that shared asset id. Native iPhone captures often use HEIC + MOV on disk; this library (and the browser tool) emit JPEG + MOV inside .livp, which Photos can import. HEIC/libheif support is intentionally out of scope.
Default movie length is capped at 3 seconds (configurable).
Examples
Class usage
from gif_to_livephoto import GifToLivePhoto
converter = GifToLivePhoto("animation.gif")
converter.convert("output.livp", max_duration=3.0, quality=23)
print(converter.get_asset_id())
Bytes in / bytes out
from gif_to_livephoto import convert_gif_to_livephoto
with open("animation.gif", "rb") as f:
gif_data = f.read()
livp_bytes = convert_gif_to_livephoto(gif_data)
with open("output.livp", "wb") as f:
f.write(livp_bytes)
Handling a missing ffmpeg
from gif_to_livephoto import convert_gif_to_livephoto, FFmpegNotFoundError
try:
convert_gif_to_livephoto("animation.gif", "output.livp")
except FFmpegNotFoundError as exc:
print(exc) # includes install instructions
Tests
pip install -e ".[test]"
pytest
# or with coverage
pytest --cov=gif_to_livephoto
Development
pip install -e ".[dev]"
pytest
black src/ tests/
ruff check src/ tests/
License
MIT. See LICENSE.
Metadata
Release files for gif-to-livephoto 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gif_to_livephoto-0.1.0.tar.gz | 12.8 kB | Without provenance | Details for gif_to_livephoto-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gif_to_livephoto-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for gif_to_livephoto-0.1.0-py3-none-any.whl |
Total release size: 25.3 kB
Release files / gif_to_livephoto-0.1.0.tar.gz
| Download URL | gif_to_livephoto-0.1.0.tar.gz |
|---|---|
| Size | 12.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d5052f6897d152c4dc16b9c758767c7ce639c01c4321011ee76cdd1453d48e8
|
|
BLAKE2b-256 checksum How to use checksums |
19d3a28fe6c781c92016bc3e40ea1f70683d987642c046f7be0378f0e8d3dc21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / gif_to_livephoto-0.1.0-py3-none-any.whl
| Download URL | gif_to_livephoto-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf56372485e19d697f6e6ed642c111d7cc60dd1967f10bb820dada954f403f46
|
|
BLAKE2b-256 checksum How to use checksums |
2d7881f702356799afe90b392c029d95f0feb6aec771b9b80bb5678b20991856
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for gif-to-livephoto 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.