reze

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

README

reze

Reze from Chainsaw Man. Not to spoil the manga or the show---let's say Reze likes cute and pretty things.

She works with all the stuff strictly graphical, like generating gallery previews, page embeds (twitter/opengraph), progressbars, etc.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadImage

func DownloadImage(link string, authority, prefix, name string) (image.Image, error)

DownloadImage attempts to download an image and returns it with any fatal errors (if occured).

func OpenImage

func OpenImage(path string) (image.Image, error)

OpenImage opens local path image and returns decoded image.

func PreserveImageHeightRatio added in v3.1.0

func PreserveImageHeightRatio(img image.Image, newWidth int) (height int)

PreserveImageHeightRatio calculates the new height of an image, given the new width, while preserving the original height ratio.

func ProgressBar

func ProgressBar(size int64, authority, prefix, action, name string) *progressbar.ProgressBar

ProgressBar will return darkness style progress bar.

func SaveJpg

func SaveJpg(reader io.Reader, filename string) error

SaveJpg saves a jpg image from an io.Reader.

Types

type PreviewGenerator

type PreviewGenerator struct {
	// contains filtered or unexported fields
}

PreviewGenerator is a struct that generates a preview image.

func InitPreviewGenerator

func InitPreviewGenerator(
	TitleFont string,
	NameFont string,
	TimeFont string,
	Width int,
	Height int,
	BackgroundColor string,
	AvatarFile string,
) PreviewGenerator

InitPreviewGenerator initializes a PreviewGenerator.

func (PreviewGenerator) Close

func (p PreviewGenerator) Close() error

Close removes the resized avatar file.

func (PreviewGenerator) Generate

func (p PreviewGenerator) Generate(
	Title, Name, Time, ColorBg, ColorFg string,
) (io.Reader, error)

Generate generates a preview image and returns it as an io.Reader.

Jump to

Keyboard shortcuts

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