# bild
![bild logo](assets/img/logo.png)
[![MIT License](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/anthonynsimon/bild/blob/master/LICENSE)
[![GoDoc](https://godoc.org/github.com/anthonynsimon/bild?status.svg)](https://godoc.org/github.com/anthonynsimon/bild)
[![Go Report Card](https://goreportcard.com/badge/github.com/anthonynsimon/bild)](https://goreportcard.com/report/github.com/anthonynsimon/bild)
A collection of parallel image processing algorithms in pure Go.
The aim of this project is simplicity in use and development over absolute high performance, but most algorithms are designed to be efficient and make use of parallelism when available.
It uses packages from the standard library whenever possible to reduce dependency use and development abstractions.
All operations return image types from the standard library.
## Documentation
The documentation for the various packages is available [here](https://pkg.go.dev/mod/github.com/anthonynsimon/bild?tab=packages).
## CLI usage
Download and compile from sources:
```
go get github.com/anthonynsimon/bild
```
Or get the pre-compiled binaries for your platform on the [releases page](https://github.com/anthonynsimon/bild/releases)
```
bild
A collection of parallel image processing algorithms in pure Go
Usage:
bild [command]
Available Commands:
adjust adjust basic image features like brightness or contrast
blend blend two images together
blur blur an image using the specified method
channel channel operations on images
effect apply effects on images
help Help about any command
histogram histogram operations on images
imgio i/o operations on images
noise noise generators
segment segment an image using the specified method
Flags:
-h, --help help for bild
--version version for bild
Use "bild [command] --help" for more information about a command.
```
For example, to apply a median effect with a radius of 1.5 on the image `input.png`, writing the result into a new file called `output.png`:
```
bild effect median --radius 1.5 input.png output.png
```
## Install package
bild requires Go version 1.11 or greater.
```bash
go get github.com/anthonynsimon/bild/...
```
## Basic package usage example:
```go
package main
import (
"github.com/anthonynsimon/bild/effect"
"github.com/anthonynsimon/bild/imgio"
"github.com/anthonynsimon/bild/transform"
)
func main() {
img, err := imgio.Open("input.jpg")
if err != nil {
fmt.Println(err)
return
}
inverted := effect.Invert(img)
resized := transform.Resize(inverted, 800, 800, transform.Linear)
rotated := transform.Rotate(resized, 45, nil)
if err := imgio.Save("output.png", rotated, imgio.PNGEncoder()); err != nil {
fmt.Println(err)
return
}
}
```
# Output examples
## Adjustment
import "github.com/anthonynsimon/bild/adjust"
### Brightness
result := adjust.Brightness(img, 0.25)
![example](assets/img/brightness.jpg)
### Contrast
result := adjust.Contrast(img, -0.5)
![example](assets/img/contrast.jpg)
### Gamma
result := adjust.Gamma(img, 2.2)
![example](assets/img/gamma.jpg)
### Hue
result := adjust.Hue(img, -42)
![example](assets/img/hue.jpg)
### Saturation
result := adjust.Saturation(img, 0.5)
![example](assets/img/saturation.jpg)
## Blend modes
import "github.com/anthonynsimon/bild/blend"
result := blend.Multiply(bg, fg)
| Add | Color Burn | Color Dodge |
| :----------: | :---------: | :------: |
| ![](assets/img/add.jpg) | ![](assets/img/colorburn.jpg) | ![](assets/img/colordodge.jpg) |
| **Darken** | **Difference** | **Divide** |
| ![](assets/img/darken.jpg) | ![](assets/img/difference.jpg) | ![](assets/img/divide.jpg) |
| **Exclusion** | **Lighten** | **Linear Burn** |
| ![](assets/img/exclusion.jpg) | ![](assets/img/lighten.jpg) | ![](assets/img/linearburn.jpg) |
| **Linear Light** | **Multiply** | **Normal** |
| ![](assets/img/linearlight.jpg) | ![](assets/img/multiply.jpg) | ![](assets/img/normal.jpg) |
| **Opacity** | **Overlay** | **Screen** |
| ![](assets/img/opacity.jpg) | ![](assets/img/overlay.jpg) | ![](assets/img/screen.jpg) |
| **Soft Light** | **Subtract** | |
| ![](assets/img/softlight.jpg) | ![](assets/img/subtract.jpg) | |
## Blur
import "github.com/anthonynsimon/bild/blur"
### Box Blur
result := blur.Box(img, 3.0)
![example](assets/img/boxblur.jpg)
### Gaussian Blur
result := blur.Gaussian(img, 3.0)
![example](assets/img/gaussianblur.jpg)
## Channel
import "github.com/anthonynsimon/bild/channel"
### Extract Channels
result := channel.Extract(img, channel.Alpha)
![example](assets/img/extractchannel.jpg)
### Extract Multiple Channels
result := channel.ExtractMultiple(img, channel.Red, channel.Alpha)
## Effect
import "github.com/anthonynsimon/bild/effect"
### Dilate
result := effect.Dilate(img, 3)
![example](assets/img/dilate.jpg)
### Edge Detection
result := effect.EdgeDetection(img, 1.0)
![example](assets/img/edgedetection.jpg)
### Emboss
result := effect.Emboss(img)
![example](assets/img/emboss.jpg)
### Erode
result := effect.Erode(img, 3)
![example](assets/img/erode.jpg)
### Grayscale
result := effect.Grayscale(img)
![example](assets/img/grayscale.jpg)
### Invert
result := effect.Invert(img)
![example](assets/img/invert.jpg)
### Median
result := effect.Median(img, 10.0)
![example](assets/img/median.jpg)
### Sepia
result := effect.Sepia(img)
![example](assets/img/sepia.jpg)
### Sharpen
result := effect.Sharpen(img)
![example](assets/img/sharpen.jpg)
### Sobel
result := effect.Sobel(img)
![example](assets/img/sobel.jpg)
### Unsharp Mask
result := effect.UnsharpMask(img, 0.6, 1.2)
![example](assets/img/unsharpmask.jpg)
## Histogram
import "github.com/anthonynsimon/bild/histogram"
### RGBA Histogram
hist := histogram.NewRGBAHistogram(img)
result := hist.Image()
![example](assets/img/histogram.png)
## Noise
import "github.com/anthonynsimon/bild/noise"
### Uniform colored
result := noise.Generate(280, 280, &noise.Options{Monochrome: false, NoiseFn: noise.Uniform})
![example](assets/img/noiseuniform.jpg)
### Binary monochrome
result := noise.Generate(280, 280, &noise.Options{Monochrome: true, NoiseFn: noise.Binary})
![example](assets/img/noisebinary.jpg)
### Gaussian monochrome
result := noise.Generate(280, 280, &noise.Options{Monochrome: true, NoiseFn: noise.Gaussian})
![example](assets/img/noisegaussian.jpg)
### Perlin Noise
result := noise.GeneratePerlin(280, 280, 0.25)
![example](assets/img/perlin.jpg)
## Paint
import "github.com/anthonynsimon/bild/paint"
### Flood Fill
// Fuzz is the percentage of maximum color distance that is tolerated
result := paint.FloodFill(img, image.Point{240, 0}, color.RGBA{255, 0, 0, 255}, 15)
![example](assets/img/floodfill.jpg)
## Segmentation
import "github.com/anthonynsimon/bild/segment"
### Threshold
result := segment.Threshold(img, 128)
![example](assets/img/threshold.jpg)
## Transform
import "github.com/anthonynsimon/bild/transform"
### Crop
// Source image is 280x280
result := transform.Crop(img, image.Rect(70,70,210,210))
![example](assets/img/crop.jpg)
### FlipH
result := transform.FlipH(img)
![example](assets/img/fliph.jpg)
### FlipV
result := transform.FlipV(img)
![example](assets/img/flipv.jpg)
### Resize Resampling Filters
result := transform.Resize(img, 280, 280, transform.Linear)
| Nearest Neighbor | Linear | Gaussian |
|:----------: | :---------: | :------: |
| ![](assets/img/resizenearestneighbor.jpg) | ![](assets/img/resizelinear.jpg) | ![](assets/img/resizegaussian.jpg) |
| **Mitchell Netravali** | **Catmull Rom** | **Lanczos** |
| ![](assets/img/resizem
没有合适的资源?快使用搜索试试~ 我知道了~
纯Go中的图像处理算法_Go_下载.zip
共136个文件
go:64个
jpg:56个
gif:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 179 浏览量
2023-04-26
10:56:19
上传
评论
收藏 3.85MB ZIP 举报
温馨提示
纯Go中的图像处理算法_Go_下载.zip
资源推荐
资源详情
资源评论
收起资源包目录
纯Go中的图像处理算法_Go_下载.zip (136个子文件)
rotation03.gif 864KB
rotation01.gif 722KB
rotation02.gif 271KB
.gitignore 529B
blend_test.go 38KB
shear_test.go 25KB
effect_test.go 24KB
resize_test.go 24KB
adjustment_test.go 12KB
blend.go 10KB
histogram_test.go 10KB
rotate_test.go 9KB
effect.go 9KB
clone_test.go 7KB
util_test.go 7KB
fill_test.go 7KB
convolution_test.go 7KB
kernel_test.go 6KB
effect.go 6KB
perlin.go 6KB
rotate.go 5KB
resize.go 5KB
blur_test.go 5KB
histogram.go 5KB
colormodel_test.go 5KB
channel_test.go 4KB
translate_test.go 4KB
noise_test.go 4KB
convolution.go 4KB
clone.go 4KB
fill.go 4KB
colormodel.go 4KB
filters.go 3KB
shear.go 3KB
blend.go 3KB
adjust.go 3KB
apply_test.go 3KB
noise.go 3KB
adjustment.go 3KB
util.go 3KB
channel.go 2KB
helpers.go 2KB
kernel.go 2KB
thresholding_test.go 2KB
io.go 2KB
rgbaf64_test.go 2KB
io_test.go 2KB
histogram.go 1KB
channel.go 1KB
blur.go 1KB
blur.go 1KB
helpers_test.go 1KB
thresholding.go 1KB
noise.go 1KB
translate.go 980B
segment.go 879B
apply.go 829B
parallel.go 803B
stack_test.go 792B
rgbaf64.go 753B
imgio.go 737B
root.go 721B
clamp_test.go 635B
stack.go 624B
parallel_test.go 352B
clamp.go 339B
helpers.go 317B
main.go 89B
noisebinary.jpg 95KB
noiseuniform.jpg 93KB
edgedetection.jpg 67KB
sharpen.jpg 64KB
emboss.jpg 61KB
saturation.jpg 61KB
sobel.jpg 60KB
noisegaussian.jpg 59KB
original.jpg 56KB
hue.jpg 56KB
unsharpmask.jpg 53KB
overlay.jpg 45KB
brightness.jpg 44KB
difference.jpg 43KB
colorburn.jpg 43KB
exclusion.jpg 43KB
softlight.jpg 42KB
linearburn.jpg 42KB
darken.jpg 42KB
subtract.jpg 42KB
multiply.jpg 42KB
divide.jpg 42KB
colordodge.jpg 42KB
invert.jpg 41KB
add.jpg 41KB
lighten.jpg 41KB
flipv.jpg 41KB
fliph.jpg 41KB
floodfill.jpg 41KB
sepia.jpg 41KB
screen.jpg 41KB
opacity.jpg 40KB
共 136 条
- 1
- 2
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9154
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功