summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2026-07-11 13:40:57 -0230
committerSam Anthony <sam@samanthony.xyz>2026-07-11 13:41:24 -0230
commitea59e2e451b3133ae2b7bafc2d57fdfbe378ee1d (patch)
treea7e1318c14e3f6de42d1dff6e4de85ba23117619
parent65efc498293def259f57e64223f7e64eb1e1536d (diff)
downloadhtmlimg-ea59e2e451b3133ae2b7bafc2d57fdfbe378ee1d.zip
-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)
+}