imgio

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package imgio provides basic image file input/output.

Index

Constants

View Source
const (
	JPEG = iota
	PNG
)

Supported image encoding types

Variables

This section is empty.

Functions

func Encode

func Encode(w io.Writer, img image.Image, format Format) error

Encode writes an image in the specified format.

Usage example:

// Encode an image to a writer in PNG format,
// returns an error if something went wrong
err := Encode(outFile, img, bild.PNG)

func Open

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

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

Usage example:

// Encode an image to a writer in PNG format,
// returns an error if something went wrong
img, err := Open("exampleName")

func Save

func Save(filename string, img image.Image, format Format) error

Save creates a file and writes to it an image in the specified format

Usage example:

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

Types

type Format

type Format int

Format is used to identify the image encoding type

Jump to

Keyboard shortcuts

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