dithering done :)
This commit is contained in:
14
util/stdio.go
Normal file
14
util/stdio.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package imageutils
|
||||
|
||||
// ProcessImage takes input png image from stdin, processes it with f and outputs it to stdout.
|
||||
func ProcessStdio(f func(image.Image) image.Image) {
|
||||
img, err := png.Decode(os.Stdin)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = png.Encode(os.Stdout, f(img))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user