b64image

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Overview

Package b64image provides helper functions for manipulating base64 encoded PNG or JPEG images

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Colorize

func Colorize(original string, clr color.Color) string

Colorize adds a color to the transparent background of the original image and returns the result. If color is the zero value, then a random color is applied.

The original must be a base64 encoded image, either JPEG or PNG. The result is a base64 encoded PNG image.

func ColorsEqual

func ColorsEqual(clr1, clr2 color.Color) bool

ColorsEqual returns true if both colors are the same

func ReadAll added in v0.1.0

func ReadAll(fileName string) (string, error)

ReadAll opens the given file which must be an image and returns its content as base64

func Resize

func Resize(original string, width, height int, avoidIfSmall bool) string

Resize a base64 encoded image. The image will be resized to the given size, while keeping the aspect ratios, and holes in the image will be filled with transparent background. The image will not be stretched if smaller than the expected size.

A None value for any of width or height mean an automatically computed value based respectively on height or width of the source image.

Types

This section is empty.

Jump to

Keyboard shortcuts

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