Documentation
¶
Index ¶
Constants ¶
View Source
const ( ColorsMin = 2 ColorsMax = 256 QualityMin int = 0 QualityMax int = 100 SpeedSlowest int = 1 SpeedDefault int = 3 SpeedFastest int = 10 )
View Source
const VERSION = "1.0.0"
VERSION respects semantic versioning.
Variables ¶
This section is empty.
Functions ¶
func RecodeImage ¶
RecodeImage handles GIF re-encoding.
Types ¶
type QuantizationAttributes ¶
type QuantizationAttributes struct {
// Specifies maximum number of colors to use. The default is 256.
// Instead of setting a fixed limit it's better to use MinQuality and MaxQuality
MaxColors int
// Quality is in range 0 (worst) to 100 (best) and values are analoguous to JPEG quality
// (i.e. 80 is usually good enough). Quantization will attempt to use the lowest number
// of colors needed to achieve maximum quality. maximum value of 100 is the default and
// means conversion as good as possible. If it's not possible to convert the image with
// at least minimum quality (i.e. 256 colors is not enough to meet the minimum quality),
// then Image.Quantize() will fail. The default minimum is 0 (proceeds regardless of quality).
//
// Features dependent on speed:
// speed 1-5: Noise-sensitive dithering
// speed 8-10 or if image has more than million colors: Forced posterization
// speed 1-7 or if minimum quality is set: Quantization error known
// speed 1-6: Additional quantization techniques
MinQuality int
MaxQuality int
// Higher speed levels disable expensive algorithms and reduce quantization precision. The
// default speed is 3. Speed 1 gives marginally better quality at significant CPU cost.
// Speed 10 has usually 5% lower quality, but is 8 times faster than the default. High
// speeds combined with Quality will use more colors than necessary and will be less likely
// to meet minimum required quality.
Speed int
}
QuantizationAttributes represents all attributes provided to imagequant.
func NewQuantizationAttributes ¶
func NewQuantizationAttributes() QuantizationAttributes
NewQuantizationAttributes returns the default quantization attributes.
Click to show internal directories.
Click to hide internal directories.