24

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:

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()
JBrouwer
  • 385
  • 1
  • 3
  • 6

3 Answers3

28

Most of the time it happens while we share gif through computer. Try to save created GIF file in your mobile device and share direct from mobile app. It worked for me every time.

TheSEOGuy
  • 291
  • 3
  • 3
9

WhatsApp doesn't support sending GIFs directly, but I just found a workaround.

Send it as a video, open it on your phone, share it and select GIF there (in the top right corner on Android).

AdB
  • 99
  • 1
  • 2
  • 1
    I just realized that this whole gif feature appears only to work if you use one of the GIF menu's (such as video -> gif or the gif tab in emoji's). This is a very weird feature to me. But this solution works, yes, thanks! – JBrouwer Mar 28 '18 at 18:56
  • @JBrouwer and not on all phones. Only where UI considers .gif to be a video. a common browser, especially desktop one, considers its MIME as picture and Whatapp recode it, taking only first frame. Rest of the file is lost. Consequently it cannot play new gif format at all (because it's a mpeg inside). THey really didn't thought of it, just slapped features together with "it works" mentality. – Swift - Friday Pie Mar 17 '23 at 08:49
2

Managed to solved it this way:

  1. Got the GIF in my computer

  2. The GIF was sent to myself as a file (not a photo), using WhatsApp web

  3. Downloaded & opened it in the phone.

Voilà!

Pablo Bianchi
  • 1,824
  • 1
  • 26
  • 30
A Koscianski
  • 115
  • 1
  • 5
  • 2
    How do you send to yourself. And how do you send asfile and not a photo? And where did you "open it in the phone"? – Rajib Jun 13 '20 at 13:58
  • ..ad on which phone. THose all are contextual. But the root of problem is: if .gif sent as image, it go only first frame in end, because file gets re-coded by CMS. – Swift - Friday Pie Mar 17 '23 at 08:53