<p>It looks like this is triggering a bug inside the libgd2 library, rather than the gd2-ffij wrapper: if two consecutive frames are identical, they try to create a temporary image of size 0x0. This triggers the "GD Warning", and then the trouble starts by leaving that gdImageGifAnimAddCtx method via some  <code>goto fail_end;</code></p>
<p>To cut a long story short, my proposal would be to skip the gif optimization mode in case both frames are identical: <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mmd-osm/openstreetmap-website/commit/7f138fb014e201e9e6b63ababf57d0f7c53bd86c/hovercard" href="https://github.com/mmd-osm/openstreetmap-website/commit/7f138fb014e201e9e6b63ababf57d0f7c53bd86c">mmd-osm@<tt>7f138fb</tt></a></p>
<p>This passes the unit tests while still producing proper images.</p>
<hr>
<p>References:</p>
<p><a href="https://github.com/libgd/libgd/blob/553702980ae89c83f2d6e254d62cf82e204956d0/src/gd_gif_out.c#L723-L727">https://github.com/libgd/libgd/blob/553702980ae89c83f2d6e254d62cf82e204956d0/src/gd_gif_out.c#L723-L727</a><br>
<a href="https://github.com/libgd/libgd/blob/553702980ae89c83f2d6e254d62cf82e204956d0/src/gd_gif_out.c#L793-L800">https://github.com/libgd/libgd/blob/553702980ae89c83f2d6e254d62cf82e204956d0/src/gd_gif_out.c#L793-L800</a></p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/issues/2132#issuecomment-479581423">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABWnLW99GnjITAquBJ7FhBiP9Xf9JSPgks5vdOL1gaJpZM4ak6Cd">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABWnLVpyrK4vLzy-ZQuGi-aB5XyhUaB_ks5vdOL1gaJpZM4ak6Cd.gif" height="1" width="1" alt="" /></p>
<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/openstreetmap/openstreetmap-website","title":"openstreetmap/openstreetmap-website","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/openstreetmap/openstreetmap-website"}},"updates":{"snippets":[{"icon":"PERSON","message":"@mmd-osm in #2132: It looks like this is triggering a bug inside the libgd2 library, rather than the gd2-ffij wrapper: if two consecutive frames are identical, they try to create a temporary image of size 0x0. This triggers the \"GD Warning\", and then the trouble starts by leaving that gdImageGifAnimAddCtx method via some  `goto fail_end;`\r\n\r\nTo cut a long story short, my proposal would be to skip the gif optimization mode in case both frames are identical: https://github.com/mmd-osm/openstreetmap-website/commit/7f138fb014e201e9e6b63ababf57d0f7c53bd86c\r\n\r\nThis passes the unit tests while still producing proper images.\r\n\r\n---\r\n\r\nReferences:\r\n\r\nhttps://github.com/libgd/libgd/blob/553702980ae89c83f2d6e254d62cf82e204956d0/src/gd_gif_out.c#L723-L727\r\nhttps://github.com/libgd/libgd/blob/553702980ae89c83f2d6e254d62cf82e204956d0/src/gd_gif_out.c#L793-L800"}],"action":{"name":"View Issue","url":"https://github.com/openstreetmap/openstreetmap-website/issues/2132#issuecomment-479581423"}}}</script>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/issues/2132#issuecomment-479581423",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/2132#issuecomment-479581423",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>