Skip to content

Latest commit

 

History

History
46 lines (35 loc) · 897 Bytes

README.md

File metadata and controls

46 lines (35 loc) · 897 Bytes

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)
}