imgio

package
v0.0.0-...-dd063a6 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package imgio provides basic image file input/output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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))

Types

type Encoder

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

Encoder encodes the provided image and writes it

func BMPEncoder

func BMPEncoder() Encoder

BMPEncoder returns an encoder to BMP

func JPEGEncoder

func JPEGEncoder(quality int) Encoder

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

func PNGEncoder

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