summaryrefslogtreecommitdiffstats
path: root/test/python-image.folk
diff options
context:
space:
mode:
authorOmar Rizwan <omar@omar.website>2026-02-06 20:29:43 +0000
committerOmar Rizwan <omar@omar.website>2026-02-06 20:29:54 +0000
commit507d189e7f72f15f9718429f34ba6db6ffbc7bda (patch)
tree5bace6aa510d0eda8e036aa7d8d93ab16f03d989 /test/python-image.folk
parentlib/python: WIP: Start on argtype registration (diff)
downloadfolk-507d189e7f72f15f9718429f34ba6db6ffbc7bda.tar.gz
folk-507d189e7f72f15f9718429f34ba6db6ffbc7bda.zip
python: WIP: Working on Image / argtype support.
Add python to prelude.
Diffstat (limited to 'test/python-image.folk')
-rw-r--r--test/python-image.folk18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/python-image.folk b/test/python-image.folk
new file mode 100644
index 00000000..3b70c9b1
--- /dev/null
+++ b/test/python-image.folk
@@ -0,0 +1,18 @@
+When { source builtin-programs/image-lib.folk }
+When the image library is /imageLib/ &\
+ the image uvx argtype definer is /defineImageArgtype/ {
+ set im [$imageLib loadPng "vendor/fonts/CourierPrimeCode.png"]
+
+ fn defineImageArgtype
+
+ set uvx [Uvx new --with pillow]
+ defineImageArgtype $uvx
+
+ $uvx def saveToDisk {Image im} {
+ import tempfile
+ fd, path = tempfile.mkstemp(suffix='.png')
+ im.save(path)
+ return path
+ }
+ puts [$uvx saveToDisk $im]
+}