imgo

package module
v0.0.0-...-59800d6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2020 License: MIT Imports: 6 Imported by: 0

README

imgo

Golang 图片工具箱

1.图片内容的查找替换

  • func (p *Picture) SetCompareAccuracy(compareAccuracy int) 设置图片在查找过程找到图片后对比的精确度,1代表100%完全吻合。
  • func (p *Picture) SearchPic(searchPic *Picture) (bool, image.Rectangle) 在大图中查找小图出现的一个区域
  • func (p *Picture) SearchAllPic(searchPic *Picture) (bool, []image.Rectangle) 在大图中查找小图出现的多个区域
  • func (p *Picture) Replace(searchPic *Picture, replacer *Picture) (image.Image, error) 在大图中查找并替换小图的一个区域
  • func (p *Picture) ReplaceAll(searchPic *Picture, replacer *Picture) (image.Image, error)在大图中查找并替换小图的多个区域
demo
pic, err := imgo.NewPng("./cat.png")
searchPic, err := imgo.NewPng("./x.png")
replace, err := imgo.NewPng("./text.png")
p, err := pic.ReplaceAll(searchPic, replace)

如果你有几万张设计稿需要替换文字或者一些图案,此工具库可能很好的帮助你编写代码

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Picture

type Picture struct {
	Img             image.Image
	Width           int
	Height          int
	Path            string
	CompareAccuracy int
}

func NewJpeg

func NewJpeg(path string) (*Picture, error)

func NewPng

func NewPng(path string) (*Picture, error)

func (*Picture) Replace

func (p *Picture) Replace(searchPic *Picture, replacer *Picture) (image.Image, error)

func (*Picture) ReplaceAll

func (p *Picture) ReplaceAll(searchPic *Picture, replacer *Picture) (image.Image, error)

func (*Picture) SearchAllPic

func (p *Picture) SearchAllPic(searchPic *Picture) (bool, []image.Rectangle)

func (*Picture) SearchPic

func (p *Picture) SearchPic(searchPic *Picture) (bool, image.Rectangle)

func (*Picture) SetCompareAccuracy

func (p *Picture) SetCompareAccuracy(compareAccuracy int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL