From 49bc31720ab6206980cda95a0a30a44e7f882fcc Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Tue, 2 Jun 2026 21:28:39 +0530 Subject: Clean up the c stuff and switch to simple bash + add example --- image.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 image.sh (limited to 'image.sh') diff --git a/image.sh b/image.sh new file mode 100755 index 0000000..b697688 --- /dev/null +++ b/image.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env sh + +DB=fun.db + +[ $# -lt 1 ] && echo "Fuck" && exit 1; + +db() { sqlite3 -list "$DB" "$@"; } + +image_id="$1" +echo "P3" +db "SELECT width, height FROM images WHERE id=$image_id" | awk -F'|' '{ print $1 " " $2 }' +echo "255" +db "SELECT r,g,b FROM pixels WHERE image_id=$image_id ORDER BY y ASC, x ASC" | tr '|' ' ' -- cgit v1.3.1