lqip

package
v0.0.0-...-b7b6a29 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrImageConfig  = "Cannot obtain image config from the file"
	ErrColorPalette = "Cannot obtain color palette from the image"
	ErrImageBase64  = "Cannot convert resized image to base64 string"
)

Meaningful error messages

Functions

This section is empty.

Types

type Color

type Color vibrant.Color

Color - Web basded color format

type Image

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

Image has basic file properties of the image

func (*Image) AspectRatio

func (i *Image) AspectRatio() float64

AspectRatio returns the aspect ratio of the image

func (*Image) ColorPalette

func (i *Image) ColorPalette() (map[string]Color, error)

ColorPalette returns the extracted colors from the image

func (*Image) Dimensions

func (i *Image) Dimensions() (int, int)

Dimensions returns the height/width of the image

func (*Image) PreviewEnhancedSrc

func (i *Image) PreviewEnhancedSrc() (string, error)

PreviewEnhancedSrc returns base64-encoded image which can be used as placeholder for large dimension preview

func (*Image) PreviewSrc

func (i *Image) PreviewSrc() (string, error)

PreviewSrc returns base64-encoded image which can be used as placeholder for small dimension preview

type ImageOps

type ImageOps interface {
	// Returns the height/width of the image
	Dimensions() (int, int)
	// Returns the aspect ratio of the image
	AspectRatio() float64
	// Returns a low quality placeholder base64 string
	PreviewSrc() (string, error)
	// Returns a low quality placeholder base64 string
	PreviewEnhancedSrc() (string, error)
	// Returns the color palette of the image
	ColorPalette() (map[string]Color, error)
}

ImageOps - List of public image functions form Image struct

func NewImage

func NewImage(imagePath string) (ImageOps, error)

NewImage implements the ImageOps interface

Jump to

Keyboard shortcuts

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