小编Yan*_*ang的帖子

Go 生成的动画 GIF 在 Windows 中不起作用

我发现一个示例在 Windows 中无法正常工作。该程序演示了 Go 标准图像包的基本用法,我们将使用它来创建位图图像序列,然后将该序列编码为 GIF 动画。

package main

import (
    "image"
    "image/color"
    "image/gif"
    "io"
    "math"
    "math/rand"
    "os"
)

import (
    "log"
    "net/http"
    "time"
)

//!+main

var palette = []color.Color{color.White, color.Black}

const (
    whiteIndex = 0 // first color in palette
    blackIndex = 1 // next color in palette
)

func main() {
    //!-main
    // The sequence of images is deterministic unless we seed
    // the pseudo-random number generator using the current time.
    // Thanks to Randall McPherson for pointing …
Run Code Online (Sandbox Code Playgroud)

image file gif go

1
推荐指数
1
解决办法
1204
查看次数

标签 统计

file ×1

gif ×1

go ×1

image ×1