summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--cmd/htmlimg/main.go26
2 files changed, 27 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f9e961c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/htmlimg
diff --git a/cmd/htmlimg/main.go b/cmd/htmlimg/main.go
new file mode 100644
index 0000000..505b8a6
--- /dev/null
+++ b/cmd/htmlimg/main.go
@@ -0,0 +1,26 @@
+package main
+
+import (
+ "fmt"
+ "image"
+ _ "image/jpeg"
+ _ "image/png"
+ "log"
+ "os"
+
+ "git.samanthony.xyz/htmlimg"
+)
+
+var lg = log.New(os.Stderr, "", 0)
+
+func main() {
+ m, _, err := image.Decode(os.Stdin)
+ if err != nil {
+ lg.Fatal(err)
+ }
+ tag, err := htmlimg.Encode(m)
+ if err != nil {
+ lg.Fatal(err)
+ }
+ fmt.Print(tag)
+}