imaging

package
v0.0.0-...-c945685 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func C

func C(x int) float64

func Cos

func Cos(y, v, n int) float64

func Cos2

func Cos2(y, x, v, u, n int) float64

func CountBits

func CountBits(num uint64) int

func PerceptualHash0

func PerceptualHash0(im image.Image) ([]byte, []float32)

TODO: maybe remove

Types

type ImageFormat

type ImageFormat string

ImageFormat is the string format of the image

const (
	DefaultGifFormat  ImageFormat = "GIF"
	DefaultJpegFormat ImageFormat = "JPEG"
	DefaultPngFormat  ImageFormat = "PNG"
	DefaultWebmFormat ImageFormat = "WEBM"
	DefaultMp4Format  ImageFormat = "MP4"
)

func (ImageFormat) IsGif

func (f ImageFormat) IsGif() bool

IsGif returns true if the type of this image is a GIF.

func (ImageFormat) IsJpeg

func (f ImageFormat) IsJpeg() bool

IsJpeg returns true if the type of this image is a JPEG.

func (ImageFormat) IsMp4

func (f ImageFormat) IsMp4() bool

IsMp4 returns true if the type of this image is a MP4.

func (ImageFormat) IsPng

func (f ImageFormat) IsPng() bool

IsPng returns true if the type of this image is a PNG.

func (ImageFormat) IsWebm

func (f ImageFormat) IsWebm() bool

IsWebm returns true if the type of this image is a WEBM.

type PixurImage

type PixurImage interface {
	Format() ImageFormat
	Dimensions() (width, height uint)
	// Duration returns how long the image is animated for, or nil if the image is not animated.
	// It may return 0s.  In the future, this could also include a histogram
	Duration() (*time.Duration, status.S)

	Thumbnail() (PixurImage, status.S)

	PerceptualHash0() ([]byte, []float32, status.S)

	Write(io.Writer) status.S

	Close()
}

func ConvertVideo

func ConvertVideo(
	ctx context.Context, dstFmt ImageFormat, dst *os.File, r io.Reader) (
	_ PixurImage, stscap status.S)

ConvertVideo converts from a source video to a destination. dstName has to be a string because ffmpeg wants to seek the output MP4 file to move the atoms around (like qt-faststart does).

func ReadImage

func ReadImage(ctx context.Context, r io.Reader) (PixurImage, status.S)

Jump to

Keyboard shortcuts

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