v0.13.0 Latest Latest

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

Go to latest
Published: Aug 23, 2020 License: MIT Imports: 6 Imported by: 54



Package imgio provides basic image file input/output.



This section is empty.


This section is empty.


func Open

func Open(filename string) (image.Image, error)

Open loads and decodes an image from a file and returns it.

Usage example:

// Decodes an image from a file with the given filename
// returns an error if something went wrong
img, err := Open("exampleName")

func Save

func Save(filename string, img image.Image, encoder Encoder) error

Save creates a file and writes to it an image using the provided encoder.

Usage example:

// Save an image to a file in PNG format,
// returns an error if something went wrong
err := Save("exampleName", img, imgio.JPEGEncoder(100))


type Encoder added in v0.11.0

type Encoder func(io.Writer, image.Image) error

Encoder encodes the provided image and writes it

func BMPEncoder added in v0.11.0

func BMPEncoder() Encoder

BMPEncoder returns an encoder to BMP

func JPEGEncoder added in v0.11.0

func JPEGEncoder(quality int) Encoder

JPEGEncoder returns an encoder to JPEG given the argument 'quality'

func PNGEncoder added in v0.11.0

func PNGEncoder() Encoder

PNGEncoder returns an encoder to PNG

Jump to

Keyboard shortcuts

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