Go语言的图像过滤工具包Gift.zip

时间:2022-08-07 13:19:15
【文件属性】:
文件名称:Go语言的图像过滤工具包Gift.zip
文件大小:1.05MB
文件格式:ZIP
更新时间:2022-08-07 13:19:15
开源项目 Gift 包提供一整套有用的图像处理过滤器。完全使用 Go 语言,没有 Go 标准库之外的外部依赖。安装/更新go get -u github.com/disintegration/gift文档http://godoc.org/github.com/disintegration/gift快速开始// 1. 创建一个新的 GIFT 过滤器列表以及添加一些过滤器 g := gift.New(     gift.Resize(800, 0, gift.LanczosResampling),     gift.UnsharpMask(1.0, 1.0, 0.0), ) // 2. 创建一个相应大小的新图像 // dst 是一个新的目标图像,src 是原始图像 dst := image.NewRGBA(g.Bounds(src.Bounds())) // 3. 使用 Draw 函数将过滤器应用到 src 并将结果存储到 dst g.Draw(dst, src)用法New 函数用于创建过滤器的序列:g := gift.New(     gift.Grayscale(),     gift.Contrast(10), )过滤器也可以使用 Add 方法被添加:g.Add(GaussianBlur(2))Bounds 方法获取原始图像的界限并为目的图像返回相应的界限以适应结果(例如使用 Resize 或 Rotate 过滤器后)dst := image.NewRGBA(g.Bounds(src.Bounds()))支持的过滤器转换Crop(rect image.Rectangle)CropToSize(width, height int, anchor Anchor)FlipHorizontal()FlipVertical()Resize(width, height int, resampling Resampling)ResizeToFill(width, height int, resampling Resampling, anchor Anchor)ResizeToFit(width, height int, resampling Resampling)Rotate(angle float32, backgroundColor color.Color, interpolation Interpolation)Rotate180()Rotate270()Rotate90()Transpose()Transverse()调整与效果Brightness(percentage float32)ColorBalance(percentageRed, percentageGreen, percentageBlue float32)ColorFunc(fn func(r0, g0, b0, a0 float32) (r, g, b, a float32))Colorize(hue, saturation, percentage float32)ColorspaceLinearToSRGB()ColorspaceSRGBToLinear()Contrast(percentage float32)Convolution(kernel []float32, normalize, alpha, abs bool, delta float32)Gamma(gamma float32)GaussianBlur(sigma float32)Grayscale()Hue(shift float32)Invert()Maximum(ksize int, disk bool)Mean(ksize int, disk bool)Median(ksize int, disk bool)Minimum(ksize int, disk bool)Pixelate(size int)Saturation(percentage float32)Sepia(percentage float32)Sigmoid(midpoint, factor float32)Sobel()UnsharpMask(sigma, amount, thresold float32)过滤器示例调整之使用 lanczos 算法重新采样原始图像处理后图像调整之使用线性算法重采样原始图像处理后图像调整大小以适应 160x160 像素边框原始图像处理后图像旋转 270 度原始图像处理后图像水平翻转原始图像处理后图像饱和度提高 50%原始图像处理后图像 标签:Gift
【文件预览】:
gift-master
----.travis.yml(207B)
----resize_test.go(9KB)
----testdata()
--------dst_sepia.png(29KB)
--------dst_color_func.png(27KB)
--------src.jpg(136KB)
--------dst_gaussian_blur.png(27KB)
--------dst_median.png(30KB)
--------dst_convolution_emboss.png(43KB)
--------dst_pixelate.png(4KB)
--------dst_invert.png(34KB)
--------dst_grayscale.png(17KB)
--------src.png(57KB)
--------dst_gamma_1.5.png(34KB)
--------dst_saturation_decrease.png(32KB)
--------dst_mean.png(27KB)
--------dst_contrast_increase.png(37KB)
--------dst_gamma_0.5.png(32KB)
--------dst_brightness_increase.png(32KB)
--------dst_rotate_30.png(44KB)
--------dst_unsharp_mask.png(39KB)
--------dst_saturation_increase.png(36KB)
--------dst_contrast_decrease.png(30KB)
--------dst_crop_to_size.png(16KB)
--------dst_rotate_180.png(34KB)
--------dst_resize.png(12KB)
--------dst_sigmoid.png(37KB)
--------dst_brightness_decrease.png(28KB)
--------dst_color_balance.png(34KB)
--------dst_hue_rotate.png(35KB)
--------dst_minimum.png(31KB)
--------dst_colorize.png(26KB)
--------dst_maximum.png(32KB)
----effects_test.go(2KB)
----pixels.go(11KB)
----rank.go(5KB)
----utils_test.go(6KB)
----transform_test.go(14KB)
----convolution_test.go(15KB)
----colors.go(12KB)
----LICENSE(1KB)
----convolution.go(14KB)
----pixels_test.go(15KB)
----transform.go(13KB)
----resize.go(11KB)
----effects.go(2KB)
----README.md(10KB)
----utils.go(4KB)
----colors_test.go(27KB)
----rank_test.go(12KB)
----gift.go(6KB)
----gift_test.go(18KB)
----go.mod(38B)

网友评论