fimage

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 9 Imported by: 0

README

fimage

Simple Go package for encoding and decoding images directly from and to file paths.

Go Reference version build-tests-checks coverage

Documentation

Overview

Simple Go package for encoding and decoding images directly from and to file paths.

Index

Constants

This section is empty.

Variables

View Source
var LogSink io.Writer

Instance of an io.Writer implementation which will be used for logging. By default, this will be initialized as io.Discard, but can be set to any desired io.Writer implementation. This is designed to NOT be a logger instance, because the package user might be using a logging library which does not offer drop-in replacement of the log standard package.

Functions

func ParseFileType

func ParseFileType(filePath string) string

Parses a file's file type from its name or path. Returns an empty string if filePath does not contain a file type extension.

func ReadImage

func ReadImage(filePath string) (image.Image, error)

Reads the image file from the provided file path if possible. If successful, the first return value represents the image as image.Image. Supported file types: gif, jpeg, jpg, png.

func WriteImage

func WriteImage(i image.Image, filePath string) error

Writes an image.Image to the provided file path if possible. Supported file types: gif, jpeg, jpg, png.

Types

This section is empty.

Jump to

Keyboard shortcuts

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