utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFileExists

func IsFileExists(filepath string) bool

IsFileExists checks if the file specified by the filepath exists.

It returns true if the file exists, otherwise false. It handles errors using os.Stat to determine existence, returning false if the file does not exist or if an error occurs.

func IsJPEGish

func IsJPEGish(extension string) bool

IsJPEGish checks if the provided file extension is either "jpg" or "jpeg".

It returns true if the extension matches "jpg" or "jpeg", otherwise false.

func IsPNG

func IsPNG(extension string) bool

IsPNG checks if the provided file extension is "png".

It returns true if the extension matches "png", otherwise false.

func SaveImage

func SaveImage(filepath string, extension string, m *image.Image) error

SaveImage saves the image pointed to by m to the specified filepath.

It saves the image in the format specified by the extension parameter. Currently supported formats include JPEG ("jpg" or "jpeg") and PNG ("png"). Returns an error if there is an issue creating the file or encoding the image.

Types

This section is empty.

Jump to

Keyboard shortcuts

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