-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone

Description
Please answer these questions before submitting your issue. Thanks!
- What version of Go are you using (
go version
)?
go version go1.6.2 - What operating system and processor architecture are you using (
go env
)?
darwin/amd64 - What did you do?
In package image/gif, I'm trying to use EncodeAll() to create a non-looping animated gif with several frames, but it will always loop. In the GIF specifications0
means forever, so-1
should the way to go to disable looping, unfortunately setting this value does not work in go. - What did you expect to see?
I should be able to setLoopCount = -1
and my resulting gif should not loop.
I want an animated gif, but not a looping animated gif. - What did you see instead?
My output gif is looping forever (same as LoopCount =0
).
The first problem lies in src/image/gif/write.go
299 if g.LoopCount < 0 {
300 g.LoopCount = 0
301 }
This should be removed to allow a negative value.
The second problem is that Netscape Looping extension header is written in the file whenever there are several frames:
147 if len(e.g.Image) > 1 {
I believe this should be changed to:
if len(e.g.Image) > 1 && e.g.LoopCount >= 0 {
Another way to fix the problem would be to change the meaning of LoopCount '0' value to actual "no loop", but this could break the expected behaviour for some people. As in other languages, setting -1
sounds ok as long as it's commented somewhere.
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.