When I create a gif, which works fine in Chrome, I cannot make it play in WhatsApp. It just shows a static image.
To give an example, I am using lua
with the lua-gd
package to draw gifs. Even the example code given, which gives a nice gif of an enlarging circle, doesn't play on WhatsApp. Note that my version of WhatsApp can view gifs just fine (for example those sent via web WhatsApp using Giphy gifs).
Here is the gif:
This is generated by the following example code by lua-gd:
require "gd"
im = gd.createPalette(120, 120)
assert(im)
black = im:colorAllocate(0, 0, 0)
blue = {}
for i = 1, 20 do
blue[i] = im:colorAllocate(0, 0, 120+6*i)
end
fp = io.open("out.gif", "w")
assert(fp, "Failed to open file for writting")
fp:write(im:gifAnimBeginStr(true, 0))
for i = 1, 20 do
tim = gd.createPalette(120, 120)
tim:paletteCopy(im)
tim:arc(60, 60, 6*i, 6*i, 0, 360, blue[21-i])
fp:write(tim:gifAnimAddStr(false, 0, 0, 5, gd.DISPOSAL_NONE))
end
fp:write(gd.gifAnimEndStr())
fp:close()