imageio

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64ToImage added in v0.2.2

func Base64ToImage(base64String string) (image.Image, error)

func BytesToBase64 added in v0.2.2

func BytesToBase64(bytes []byte) (string, error)

func ImageToBase64 added in v0.2.2

func ImageToBase64(img image.Image) (string, error)

func ImageToBytes added in v0.2.2

func ImageToBytes(img image.Image) ([]byte, error)

func IsStdoutOutput

func IsStdoutOutput(flags config.GlobalSubCommandFlags, args []string) bool

IsStdoutOutput checks if the output destination indicates stdout

func LoadFileBytes added in v0.2.2

func LoadFileBytes(src ImageReader) ([]byte, error)

func LoadImage added in v0.2.2

func LoadImage(imgSrc ImageReader) (image.Image, error)

func SaveGif added in v0.2.2

func SaveGif(gifData gif.GIF, output string) error

func SaveImage added in v0.2.2

func SaveImage(img image.Image, output ImageWriter, format string, metadata types.ImageMetadata) error

func SaveText added in v0.2.2

func SaveText(text string, output ImageWriter) error

func SaveUrlAsImg added in v0.2.2

func SaveUrlAsImg(url string) (string, error)

Types

type FileReader

type FileReader struct {
	Path string
}

func GetFilesFromDirectory added in v0.2.2

func GetFilesFromDirectory(path string, filter func(string, fs.DirEntry) bool) ([]FileReader, error)

func (FileReader) Open

func (fr FileReader) Open() (*os.File, error)

func (FileReader) String

func (fr FileReader) String() string

type FileWriter

type FileWriter struct {
	Path string
}

func (FileWriter) Create

func (fw FileWriter) Create() (*os.File, error)

func (FileWriter) String

func (fw FileWriter) String() string

type ImageIO

type ImageIO struct {
	ImageInput  ImageReader
	ImageOutput ImageWriter
	Format      string
}

func DetermineImageOperations

func DetermineImageOperations(flags config.GlobalSubCommandFlags, args []string, cmd *cobra.Command) ([]ImageIO, error)

DetermineImageOperations generates ImageIO structs based on program flags and command io arguments.

func SingleIO

func SingleIO(flags config.GlobalSubCommandFlags, args []string, cmd *cobra.Command) ([]ImageIO, error)

SingleIO handles both file and STDIN input cases

type ImageReader

type ImageReader interface {
	Open() (*os.File, error)
	String() string
}

Input image abstraction

type ImageWriter

type ImageWriter interface {
	Create() (*os.File, error)
	String() string
}

Ouput image abstraction

type Stdin

type Stdin struct{}

func (Stdin) Open

func (ss Stdin) Open() (*os.File, error)

func (Stdin) String

func (ss Stdin) String() string

type Stdout

type Stdout struct{}

func (Stdout) Create

func (so Stdout) Create() (*os.File, error)

func (Stdout) String

func (so Stdout) String() string

Jump to

Keyboard shortcuts

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