images

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package images implements functions related to image manipulation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileToImage

func FileToImage(file *os.File) (img image.Image, err error)

FileToImage turns a os.File object into an image. This function should support opening of BMP, GIF, JPG, and PNG files.

func FitToDimensions

func FitToDimensions(img image.Image, bound, canvas image.Point) image.Image

FitToDimensions will create an image containing an original inside a canvas.X by canvas.Y image that uses the RGBA color model. The image will be resized if it exceeds bound.X x bound.Y, Having negative coordinates in bound or canvas may lead to unexpected behavior.

func ReadDimensions

func ReadDimensions(img image.Image) (width, height uint)

ReadDimensions reads the dimensions of an image.Image file and returns the width and height

func SaveToJPG

func SaveToJPG(img image.Image, filename string) (err error)

SaveToJPG encodes an image to the JPG format and saves it to a file If filename already exists it will overwrite it.

func SaveToPNG

func SaveToPNG(img image.Image, filename string) (err error)

SaveToPNG encodes an image to the PNG format and saves it to a file If filename already exists it will overwrite it.

func StackVertically added in v0.2.1

func StackVertically(first image.Image, others ...image.Image) image.Image

StackVertically stacks images on top of each other and returns the stacked version using the RGBA color model. The width of the image is that of the widest image and the height is the sum of all the images' heights. All images are arranged such that they are horizontally centered and vertically on top of each other with no space between. If some images are narrower than others, the gap will be filled with transparency.

Types

This section is empty.

Jump to

Keyboard shortcuts

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