Cybrkyd's git repositories

imaging-with-python • commit: e2ae28c

commit e2ae28c461c4e5a430becbbbd008f6a0fd9e52e8e851cd2d3969ef7cb9d2d335
author cybrkyd <116197215+cybrkyd@users.noreply.github.com> 2023-02-13 11:22:08 +0000
committer cybrkyd <116197215+cybrkyd@users.noreply.github.com> 2023-02-13 11:22:08 +0000

Commit Message

README

📊 Diffstat

README.md 23
gradients/10.sh 9
gradients/examples/w.png
gradients/examples/x.png
gradients/examples/y.png
gradients/examples/z.png
gradients/gradients.py 23
7 files changed, 22 insertions(+), 33 deletions(-)

Diff

diff --git a/README.md b/README.md
index 1774d9d..b79372c 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,22 @@
- # imaging-with-python
\ No newline at end of file
+
+ # Imaging with Python
+
+ A Python script to generate random gradients. Output is in SVG format and combines two random colours (rgb 0-255) into a random linear gradient.
+
+ The Python script will output one gradient file; combine with **10.sh** to generate 10 random gradients.
+
+ ## Examples
+
+ [![W](https://github.com/cybrkyd/imaging-with-python/blob/main/examples/w.png "w.png")](https://github.com/cybrkyd/imaging-with-python/blob/main/examples/w.png)
+
+ [![X](https://github.com/cybrkyd/imaging-with-python/blob/main/examples/x.png "x.png")](https://github.com/cybrkyd/imaging-with-python/blob/main/examples/x.png)
+
+ [![Y](https://github.com/cybrkyd/imaging-with-python/blob/main/examples/y.png "y.png")](https://github.com/cybrkyd/imaging-with-python/blob/main/examples/y.png)
+
+ [![Z](https://github.com/cybrkyd/imaging-with-python/blob/main/examples/z.png "z.png")](https://github.com/cybrkyd/imaging-with-python/blob/main/examples/z.png)
+
+ I use some as image backgrounds on my blog - see https://cybrkyd.com
+
+ ## Licences
+ Imaging with Python is available under a [GPL3 license](https://github.com/cybrkyd/imaging-with-python/blob/main/LICENSE).
+
diff --git a/gradients/10.sh b/gradients/10.sh
deleted file mode 100644
index d8cf850..0000000
--- a/gradients/10.sh
+++ /dev/null
@@ -1,9 +0,0 @@
- #!/bin/bash
- for i in {1..10}
- do
- python3 gradient.py
- sleep 1
- mv grad.svg $i.svg
- sleep 1
- done
-
diff --git a/gradients/examples/w.png b/gradients/examples/w.png
deleted file mode 100644
index 455b449..0000000
Binary files a/gradients/examples/w.png and /dev/null differ
diff --git a/gradients/examples/x.png b/gradients/examples/x.png
deleted file mode 100644
index 439e83c..0000000
Binary files a/gradients/examples/x.png and /dev/null differ
diff --git a/gradients/examples/y.png b/gradients/examples/y.png
deleted file mode 100644
index c54562a..0000000
Binary files a/gradients/examples/y.png and /dev/null differ
diff --git a/gradients/examples/z.png b/gradients/examples/z.png
deleted file mode 100644
index 60b75e8..0000000
Binary files a/gradients/examples/z.png and /dev/null differ
diff --git a/gradients/gradients.py b/gradients/gradients.py
deleted file mode 100644
index 184fa25..0000000
--- a/gradients/gradients.py
+++ /dev/null
@@ -1,23 +0,0 @@
- import random
-
- class rand():
- def __str__(self):
- return str(random.randint(0, 100))
-
- class rgbset():
- def __str__(self):
- return str(random.randint(0, 255))
-
- ran = rand()
- rgb = rgbset()
-
- svg1 = '<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 1400 400">\n<rect width="1400" height="400"/>\n<defs>\n'
- svg2 = '<linearGradient id="a" x1="'+str(ran)+'%" y1="'+str(ran)+'%" x2="'+str(ran)+'%" y2="'+str(ran)+'%">\n'
- svg3 = '<stop offset="0%" style="stop-color:rgb('+str(rgb)+','+str(rgb)+','+str(rgb)+');stop-opacity:1" />\n'
- svg4 = '<stop offset="100%" style="stop-color:rgb('+str(rgb)+','+str(rgb)+','+str(rgb)+');stop-opacity:1" />\n'
- svg5 = '</linearGradient>\n</defs>\n<rect fill="url(#a)" width="1400" height="400"/>\n</svg>'
-
- # write to file
- file = open("grad.svg", "w")
- file.writelines("%s%s%s%s%s" % (svg1,svg2,svg3,svg4,svg5))
- file.close()