pxl

package
v0.0.0-...-41a197c Latest Latest
Warning

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

Go to latest
Published: May 1, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Bit8   = 8 * scalingFactor
	Bit16  = 16 * scalingFactor
	Bit32  = 32 * scalingFactor
	Bit64  = 64 * scalingFactor
	Bit128 = 128 * scalingFactor
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Palette     color.Palette
	Granularity int
	MaxWidth    int
	MaxHeight   int
}

type Pixelizer

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

func New

func New() *Pixelizer

func NewFromConfig

func NewFromConfig(c *Config) *Pixelizer

func (*Pixelizer) Convert

func (p *Pixelizer) Convert(img image.Image, colorize bool) image.Image

Convert creates a pixelized version for a given img

func (*Pixelizer) SetColors

func (p *Pixelizer) SetColors(cp color.Palette)

func (*Pixelizer) SetGranularity

func (p *Pixelizer) SetGranularity(s int)

SetGranularity sets the Pixelizer Granularity level. s must be a positive int value in range 0 - 128.

func (*Pixelizer) SetMaxImageSize

func (p *Pixelizer) SetMaxImageSize(maxWidth, maxHeight int)

type SerializablePalette

type SerializablePalette struct {
	Palette []color.Color
}

func GetColorsFromImage

func GetColorsFromImage(img image.Image, count int) (*SerializablePalette, error)

func (*SerializablePalette) MarshalJSON

func (s *SerializablePalette) MarshalJSON() ([]byte, error)

func (*SerializablePalette) UnmarshalJSON

func (s *SerializablePalette) UnmarshalJSON(b []byte) error

Jump to

Keyboard shortcuts

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