Dmitry Timoshkov (@dmitry) commented about dlls/windowscodecs/gifformat.c:
/* Image Data */ - hr = gif_compress(This->encoder->stream, This->image_data, This->width * This->height); + hr = gif_compress(This->encoder->stream, This->image_data, This->width * This->height, color_bits); if (hr == S_OK) This->committed = TRUE; } } + else if (hr == S_OK) + { + int color_bits = 1; + while ((1 << color_bits) < This->encoder->colors) color_bits++; + + hr = gif_compress(This->encoder->stream, This->image_data, This->width * This->height, color_bits); + if (hr == S_OK) + This->committed = TRUE; + }
It should be possible to avoid the code duplication, for instance by writing palette only when necessary. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9486#note_122498