Documentation ¶
Overview ¶
Package imgutil implements some image utility functions.
Index ¶
- func ColorEq(c1, c2 color.Color) bool
- func Equal(img1, img2 image.Image) bool
- func NewSubImage(src image.Image, bounds image.Rectangle) image.Image
- func ReadFile(imgPath string) (img image.Image, err error)
- func WriteBMP(imgPath string, img image.Image) (err error)
- func WriteFile(imgPath string, img image.Image) (err error)
- func WriteJPEG(imgPath string, img image.Image, quality int) (err error)
- type SubImager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSubImage ¶
NewSubImage returns a subimage of the given source image based on the specified bounds.
func ReadFile ¶
ReadFile reads an image file (gif, jpeg or png) specified by imgPath and returns it as an image.Image.
func WriteBMP ¶
WriteBMP writes the image data to a BMP file specified by imgPath. WriteBMP creates the named file using mode 0666 (before umask), truncating it if it already exists
func WriteFile ¶
WriteFile writes the image data to a PNG file specified by imgPath. WriteFile creates the named file using mode 0666 (before umask), truncating it if it already exists.
Types ¶
type SubImager ¶
type SubImager interface { image.Image // SubImage returns an image representing the portion of the image visible // through r. The returned value shares pixels with the original image. SubImage(r image.Rectangle) image.Image }
SubImager is an interface that extends the basic image.Image interface with the SubImage method.
func SubFallback ¶
SubFallback returns the provided image.Image as a SubImager. It provides a fallback for images missing the SubImage method.