Skip to content

Clamp GIF frame dimensions to one alignment block - #92

Open
dwaycik wants to merge 1 commit into
strodgers:mainfrom
dwaycik:fix/gif-dimensions-zero-axis
Open

Clamp GIF frame dimensions to one alignment block#92
dwaycik wants to merge 1 commit into
strodgers:mainfrom
dwaycik:fix/gif-dimensions-zero-axis

Conversation

@dwaycik

@dwaycik dwaycik commented Jul 31, 2026

Copy link
Copy Markdown

best_gif_dimensions() floors each axis to a multiple of 64, which drives the short axis of a wide or tall source to zero:

>>> from epomakercontroller.commands.EpomakerGifCommand import EpomakerGifCommand
>>> EpomakerGifCommand.best_gif_dimensions(800, 200)
(128, 0)

An 800x200 GIF fits to 162x41, and floor(41 / 64) * 64 == 0.

Zero then passes the per_frame_size % 4096 guard in __init__, because 0 % 4096 == 0, so the upload proceeds and sends an empty frame rather than raising the ValueError that guard exists to raise.

Clamping to a single 64px block keeps every result 4K-aligned, since any pair of multiples of 64 satisfies it: 64a * 64b * 2 == 8192ab.

Found while building a GTK front end against 0.0.9. Thanks for the GIF work — the multi-frame protocol is the reason the RT100 screen is usable on Linux at all.

best_gif_dimensions() floors each axis to a multiple of 64, which drives the
short axis of a wide or tall source to zero: an 800x200 GIF fits to 162x41,
and floor(41 / 64) * 64 == 0.

Zero then passes the per_frame_size % 4096 guard in __init__, because
0 % 4096 == 0, so the upload proceeds and sends an empty frame rather than
raising. Clamping to a single 64px block keeps every result 4K-aligned:
64a * 64b * 2 == 8192ab.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant