image

package
v0.0.0-...-0409f2c Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeImage

func DecodeImage(r io.Reader, format Format) (image.Image, error)

DecodeImage decodes image from reader with specified format

func IsValidFormat

func IsValidFormat(format Format) bool

IsValidFormat checks if format is valid

func SaveAsSVG

func SaveAsSVG(img image.Image, path string) error

SaveAsSVG saves image as SVG format (embedded via base64)

func SaveImage

func SaveImage(img image.Image, path string, format Format) error

SaveImage saves an image to file with specified format

func SaveImageWithQuality

func SaveImageWithQuality(img image.Image, path string, format Format, quality int) error

SaveImageWithQuality saves an image to file with specified format and quality

Types

type Format

type Format string

Format represents image format

const (
	FormatJPEG Format = "jpeg"
	FormatPNG  Format = "png"
	FormatGIF  Format = "gif"
	FormatWEBP Format = "webp"
	FormatBMP  Format = "bmp"
	FormatTIFF Format = "tiff"
)

func DetectFormat

func DetectFormat(r io.Reader) Format

DetectFormat detects image format from reader

func FormatFromExtension

func FormatFromExtension(ext string) Format

FormatFromExtension gets format from file extension

func FormatFromFilename

func FormatFromFilename(filename string) Format

FormatFromFilename gets format from filename

type Processor

type Processor struct{}

Processor provides image processing functions

func NewProcessor

func NewProcessor() *Processor

NewProcessor creates a new image processor

func (*Processor) AddBorder

func (p *Processor) AddBorder(img image.Image, width int, colorStr string) image.Image

AddBorder adds a border to an image

func (*Processor) AddRoundCorners

func (p *Processor) AddRoundCorners(img image.Image, radius int) image.Image

AddRoundCorners adds rounded corners to an image

func (*Processor) AddText

func (p *Processor) AddText(img image.Image, text string, x, y, fontSize int, textColorStr string) image.Image

AddText adds text to an image

func (*Processor) AddWatermark

func (p *Processor) AddWatermark(img image.Image, text, position string) image.Image

AddWatermark adds a text watermark to an image

func (*Processor) Adjust

func (p *Processor) Adjust(img image.Image, brightness, contrast, saturation float64) image.Image

Adjust adjusts brightness, contrast, and saturation of an image

func (*Processor) ApplyFilter

func (p *Processor) ApplyFilter(img image.Image, filterType string) image.Image

ApplyFilter applies a filter to an image

func (*Processor) Blend

func (p *Processor) Blend(img1, img2 image.Image, opacity float64) image.Image

Blend blends two images with specified opacity

func (*Processor) Crop

func (p *Processor) Crop(img image.Image, rect image.Rectangle) image.Image

Crop crops an image to the specified rectangle

func (*Processor) Flip

func (p *Processor) Flip(img image.Image, direction string) image.Image

Flip flips an image horizontally or vertically

func (*Processor) GetHistogram

func (p *Processor) GetHistogram(img image.Image) map[string][]int

GetHistogram gets histogram information for an image

func (*Processor) Resize

func (p *Processor) Resize(img image.Image, width, height int) image.Image

Resize resizes an image to the specified dimensions using high-quality scaling

func (*Processor) Rotate

func (p *Processor) Rotate(img image.Image, angle int) image.Image

Rotate rotates an image by the specified angle (90, 180, or 270 degrees)

Jump to

Keyboard shortcuts

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