glitch

package
v0.0.0-...-f2e4f82 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

README

glitch

Example

See glitchlock.

package main

import (
        "image/png"
        "os"

        "github.com/kbinani/screenshot"
        "github.com/moolen/glitchlock/glitch"
)

func main() {
        bounds := screenshot.GetDisplayBounds(0)
        img, _ := screenshot.CaptureRect(bounds)

        // first censor, then distort
        censored, err := glitch.Censor(img)
        if err != nil {
                panic(err)
        }
        glitch, err := glitch.Distort(censored, &glitch.DistortConfig{
                Pixelate: 3,
                Pieces:   10,
                Seed:     1312,
        })
        if err != nil {
                panic(err)
        }
        file, err := os.Create("glitch.png")
        if err != nil {
                panic(err)
        }
        defer file.Close()
        png.Encode(file, glitch)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Censor

func Censor(in *image.RGBA) (*image.RGBA, error)

Censor analyzes the input image for text and censors it

func Distort

func Distort(in *image.RGBA, dc *DistortConfig) (*image.RGBA, error)

Distort distorts the input image by manipulating color channels and cropping/rotating/translating slices of the input image

Types

type DistortConfig

type DistortConfig struct {
	Pixelate int
	Pieces   int
	Seed     int64
}

DistortConfig configures the glitch behavior

Jump to

Keyboard shortcuts

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