util

package
v0.0.0-...-15e6893 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package util contains utility code for demosntration of go-libjpeg.

Index

Constants

This section is empty.

Variables

View Source
var SubsampledImages = []string{
	"checkerboard_444.jpg",
	"checkerboard_440.jpg",
	"checkerboard_422.jpg",
	"checkerboard_420.jpg",
}

SubsampledImages contains example images which have subsampling colors.

Functions

func CreateFile

func CreateFile(name string) (f *os.File)

CreateFile opens specified example file

func GetExFilePath

func GetExFilePath(name string) string

GetExFilePath returns the path of specified example file.

func GetOutFilePath

func GetOutFilePath(name string) string

GetOutFilePath returns the path of specified out file.

func MatchColor

func MatchColor(a, b color.Color, tolerance int) (matched bool)

MatchColor returns whteher the difference between two colors is smaller than the given tolerance. If the two colors a and b assume to the same, it returns true.

func MatchImage

func MatchImage(a, b image.Image, tolerance int) (diff image.Image, err error)

MatchImage matches by pixel-by-pixel. If any one of pixel does not matched, it returns an error with image difference (a - b).

func OpenFile

func OpenFile(name string) (io io.Reader)

OpenFile opens specified example file

func ReadFile

func ReadFile(name string) (data []byte)

ReadFile reads and returns data bytes of specified example file.

func WritePNG

func WritePNG(img image.Image, name string)

WritePNG encodes and writes image into PNG file.

Types

This section is empty.

Jump to

Keyboard shortcuts

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