From 3be6325b1292233fae4817b3b864eca7b9911898 Mon Sep 17 00:00:00 2001
From: Akshay Nair <phenax5@gmail.com>
Date: Wed, 3 Jun 2026 23:41:42 +0530
Subject: Add generated images to dir + readme

---
 src/gradient.sql | 12 ++++++++++++
 1 file changed, 12 insertions(+)
 create mode 100644 src/gradient.sql

(limited to 'src/gradient.sql')

diff --git a/src/gradient.sql b/src/gradient.sql
new file mode 100644
index 0000000..f04cdad
--- /dev/null
+++ b/src/gradient.sql
@@ -0,0 +1,12 @@
+DELETE FROM images WHERE id = 'gradient';
+INSERT INTO images (id, width, height) VALUES ('gradient', 200, 200) RETURNING id;
+
+WITH RECURSIVE
+  image AS (SELECT * FROM images WHERE id = 'gradient'),
+  horizontal(x) AS
+    (SELECT width FROM image UNION ALL SELECT x - 1 FROM horizontal WHERE x > 1),
+  vertical(y) AS
+    (SELECT height FROM image UNION ALL SELECT y - 1 FROM vertical WHERE y > 1),
+  _pixels(x, y, r, g, b) AS
+    (SELECT x, y, mod(x, 255), mod(y, 255), 100 FROM vertical, horizontal)
+INSERT INTO pixels (image_id, x, y, r, g, b) SELECT 'gradient', x, y, r, g, b FROM _pixels;
-- 
cgit v1.3.1

