imutil

package
v0.0.0-...-51c8454 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package imutil contains various internal image utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(in image.Image) (ret image.Image)

Copy creates a deep copy of an image (copies underlying buffer).

func Dump

func Dump(path string, img image.Image) error

Dump dumps an image to a file. Format is determined by file ending. PNG and JPG are supported.

func DumpGIF

func DumpGIF(path string, img *gif.GIF) error

DumpGIF dumps a GIF image to a file.

func DumpJPEG

func DumpJPEG(path string, img image.Image, quality int) error

DumpJPEG dumps a JPEG to a file with a given quality.

func Load

func Load(path string) (image.Image, error)

Load tries to load an image from a file.

func NewYuv420

func NewYuv420(buf []byte, w, h int) image.Image

NewYuv420 creates a new image.Image from a raw Yuv420p buffer. The returned image will reference buf and no data is copied.

func RandGray

func RandGray(seed int64, w, h int) *image.Gray

RandGray creates a random grayscale image with a given seed.

func RandRGBA

func RandRGBA(seed int64, w, h int) *image.RGBA

RandRGBA creates a random RGBA image with a given seed.

func Sub

func Sub(img image.Image, r image.Rectangle) (image.Image, error)

Sub tries to call SubImage on the given image.

func ToGray

func ToGray(img image.Image) *image.Gray

ToGray returns a new copy of img, converted to grayscale, with the origin of its bounds reset to 0.

func ToRGBA

func ToRGBA(img image.Image) *image.RGBA

ToRGBA returns a new copy of img, converted to RGBA, with the origin of its bounds reset to 0.

Types

type YCbCr

type YCbCr struct {
	Pix  []byte
	Rect image.Rectangle
}

YCbCr is a raw YCbCr image.

func (*YCbCr) At

func (i *YCbCr) At(x, y int) color.Color

At implements image.Image.

func (*YCbCr) Bounds

func (i *YCbCr) Bounds() image.Rectangle

Bounds implements image.Image.

func (*YCbCr) ColorModel

func (i *YCbCr) ColorModel() color.Model

ColorModel implements image.Image.

Jump to

Keyboard shortcuts

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