animated gif in golang – creation of *image.Paletted

huangapple go评论73阅读模式
英文:

animated gif in golang - creation of *image.Paletted

问题

我想用Go语言创建一个动画GIF。

为此,我需要计算多个image.Paletted

但是当我想要创建它时,我需要一个p color.Palette,但我不知道如何获取调色板。

我该如何获取调色板?

英文:

I want to create an animated gif with go.

I need for that to compute multiple *image.Paletted.

But when I want to create it, I need p color.Palette but I don't know how to get the palette

How can I have the Palette?

答案1

得分: 1

标准库中有一个专门的包用于此:https://golang.org/pkg/image/color/palette/

目前有两个预定义的调色板可用:Plan9和WebSafe

您可以像这样使用该包:

frame := image.NewPaletted(
	image.Rect(0, 0, 100, 200),
	palette.WebSafe,
)
英文:

The standard library has a own package for that: https://golang.org/pkg/image/color/palette/

At the moment there are two predefined palettes availiable: Plan9 and WebSafe

You can use the package like that:

frame := image.NewPaletted(
	image.Rect(0, 0, 100, 200),
	palette.WebSafe,
)

huangapple
  • 本文由 发表于 2017年1月18日 03:55:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/41705828.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定