-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
Description
What did you do?
from PIL import Image
green = Image.open("green.png")
red = Image.open("red.png")
green.save("opt.gif", save_all=True, append_images=[red], disposal=2, loop=0, duration=500) What did you expect to happen?
Pillow should create this GIF:
What actually happened?
Pillow actually creates this GIF, with the second frame "missing" two pixels in height, which get shown as transparent:

> identify opt.gif
opt.gif[0] GIF 250x217 250x217+0+0 8-bit sRGB 32c 0.000u 0:00.000
opt.gif[1] GIF 250x215 250x217+0+0 8-bit sRGB 64c 5237B 0.000u 0:00.000What I discovered so far:
- If the black color gets changed to a black-ish color (e.g., rgb(2, 0, 0)), the issue disappears
- If the
disposalmethod is not2, the issue disappears - If
optimize=False, the issue disappears (see theno_opt.gifcreated above in the "expect to happen" section)
This problem seems related, but not identical, to #8003.
What are your OS, Python and Pillow versions?
- OS: macOS 14.5
- Python: 3.12.3
- Pillow: 10.4.0
--------------------------------------------------------------------
Pillow 10.4.0
Python 3.12.3 (main, Apr 9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)]
--------------------------------------------------------------------
Python executable is /Users/lucach/Library/Caches/pypoetry/virtualenvs/pytamaro-5GgIxOWM-py3.12/bin/python
Environment Python files loaded from /Users/lucach/Library/Caches/pypoetry/virtualenvs/pytamaro-5GgIxOWM-py3.12
System Python files loaded from /opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.12
--------------------------------------------------------------------
Python Pillow modules loaded from /Users/lucach/Library/Caches/pypoetry/virtualenvs/pytamaro-5GgIxOWM-py3.12/lib/python3.12/site-packages/PIL
Binary Pillow modules loaded from /Users/lucach/Library/Caches/pypoetry/virtualenvs/pytamaro-5GgIxOWM-py3.12/lib/python3.12/site-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok, compiled for 10.4.0
*** TKINTER support not installed
--- FREETYPE2 support ok, loaded 2.13.2
--- LITTLECMS2 support ok, loaded 2.16
--- WEBP support ok, loaded 1.4.0
--- WEBP Transparency support ok
--- WEBPMUX support ok
--- WEBP Animation support ok
--- JPEG support ok, compiled for libjpeg-turbo 3.0.3
--- OPENJPEG (JPEG2000) support ok, loaded 2.5.2
--- ZLIB (PNG/ZIP) support ok, loaded 1.3.1
--- LIBTIFF support ok, loaded 4.6.0
--- RAQM (Bidirectional Text) support ok, loaded 0.10.1, fribidi 1.0.14, harfbuzz 8.5.0
*** LIBIMAGEQUANT (Quantization method) support not installed
--- XCB (X protocol) support ok
--------------------------------------------------------------------

