Created
September 9, 2018 08:40
-
-
Save betandr/45e03c147dcb8b4f263b024fa815bc9c to your computer and use it in GitHub Desktop.
Very Basic Gif Maker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "image" | |
import "image/gif" | |
import "os" | |
func main() { | |
files := os.Args[1:] | |
// files := []string{"g1.gif", "g2.gif","g3.gif", "g2.gif"} | |
// load static image and construct outGif | |
outGif := &gif.GIF{} | |
for _, name := range files { | |
f, _ := os.Open(name) | |
inGif, _ := gif.Decode(f) | |
f.Close() | |
outGif.Image = append(outGif.Image, inGif.(*image.Paletted)) | |
outGif.Delay = append(outGif.Delay, 0) | |
} | |
// save to out.gif | |
// f, _ := os.OpenFile("out.gif", os.O_WRONLY|os.O_CREATE, 0600) | |
// defer f.Close() | |
gif.EncodeAll(os.Stdout, outGif) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment