diff --git a/pkg/dithering/IMG_0732.jpg b/pkg/dithering/IMG_0732.jpg new file mode 100644 index 0000000..2ae773e Binary files /dev/null and b/pkg/dithering/IMG_0732.jpg differ diff --git a/pkg/dithering/cmd/jpg2png.go b/pkg/dithering/cmd/jpg2png.go new file mode 100644 index 0000000..07bbd8a --- /dev/null +++ b/pkg/dithering/cmd/jpg2png.go @@ -0,0 +1,20 @@ +//go:build ignore + +package main + +import ( + "image/jpeg" + "image/png" + "os" +) + +func main() { + img, err := jpeg.Decode(os.Stdin) + if err != nil { + panic(err) + } + err = png.Encode(os.Stdout, img) + if err != nil { + panic(err) + } +} diff --git a/pkg/dithering/cmd/main.go b/pkg/dithering/cmd/main.go index 6ae3cb7..3069708 100644 --- a/pkg/dithering/cmd/main.go +++ b/pkg/dithering/cmd/main.go @@ -1,6 +1,8 @@ package main import ( + "image" + "git.nkpl.cc/twocookedfaggots/imageutils/pkg/dithering" "git.nkpl.cc/twocookedfaggots/imageutils/util" ) diff --git a/pkg/dithering/cmd/nz9ipc5vywca1.jpg b/pkg/dithering/cmd/nz9ipc5vywca1.jpg new file mode 100644 index 0000000..427d887 Binary files /dev/null and b/pkg/dithering/cmd/nz9ipc5vywca1.jpg differ diff --git a/pkg/dithering/cmd/something.png b/pkg/dithering/cmd/something.png new file mode 100644 index 0000000..11d70a8 Binary files /dev/null and b/pkg/dithering/cmd/something.png differ diff --git a/pkg/dithering/cmd/touhouthemedbj.png b/pkg/dithering/cmd/touhouthemedbj.png new file mode 100644 index 0000000..533a1ee Binary files /dev/null and b/pkg/dithering/cmd/touhouthemedbj.png differ diff --git a/pkg/palette b/pkg/palette new file mode 160000 index 0000000..e161720 --- /dev/null +++ b/pkg/palette @@ -0,0 +1 @@ +Subproject commit e161720f1cf08d296c750662eaf5ae4d25811b74 diff --git a/util/hex.go b/util/hex.go index 65aa065..d0e8af3 100644 --- a/util/hex.go +++ b/util/hex.go @@ -1,9 +1,9 @@ -package imageutils +package util import ( + "errors" "fmt" "image/color" - "errors" ) var ParseHexColorErr = errors.New("invalid length, must be 7 or 4") diff --git a/util/hex_test.go b/util/hex_test.go index 6a0123c..7dc0cab 100644 --- a/util/hex_test.go +++ b/util/hex_test.go @@ -1,4 +1,4 @@ -package imageutils +package util import ( "fmt" diff --git a/util/stdio.go b/util/stdio.go index 3b0757b..d826b7d 100644 --- a/util/stdio.go +++ b/util/stdio.go @@ -1,8 +1,14 @@ -package imageutils +package util + +import ( + "image" + "image/png" + "os" +) // 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) +func ProcessStdio(f func(image.Image) image.Image) error { + img, err := png.Decode(os.Stdin) if err != nil { return err }