After Width: | Height: | Size: 462 KiB |
@ -0,0 +1,30 @@ |
|||||||
|
import os, random |
||||||
|
from PIL import Image |
||||||
|
|
||||||
|
light_directory = os.fsencode(str(os.getcwd() + "/planets/light")) |
||||||
|
noise_directory = os.fsencode(str(os.getcwd() + "/planets/noise")) |
||||||
|
sphere_directory = os.fsencode(str(os.getcwd() + "/planets/sphere")) |
||||||
|
|
||||||
|
amount_lights = len(os.listdir(light_directory)) |
||||||
|
amount_noise = len(os.listdir(noise_directory)) |
||||||
|
amount_sphere = len(os.listdir(sphere_directory)) |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def blendPlanetParts(light, noise, sphere, alpha): |
||||||
|
blended = Image.blend(sphere, light, alpha) |
||||||
|
blended2 = Image.blend(blended, noise, alpha) |
||||||
|
return blended2 |
||||||
|
|
||||||
|
|
||||||
|
def getRandomPlanet(): |
||||||
|
light = Image.open("planets/light/light" + str(random.randrange(0,amount_lights)) + ".png").convert('RGBA') |
||||||
|
noise = Image.open("planets/noise/noise" + str(random.randrange(0,amount_noise)) + ".png").convert('RGBA') |
||||||
|
sphere = Image.open("planets/sphere/sphere" + str(random.randrange(0,amount_sphere)) + ".png").convert('RGBA') |
||||||
|
|
||||||
|
planet = blendPlanetParts(light, noise, sphere, 0.1) |
||||||
|
|
||||||
|
return planet |
||||||
|
|
||||||
|
planet = getRandomPlanet() |
||||||
|
planet.save('planet1.png') |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 66 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 68 KiB |
After Width: | Height: | Size: 42 KiB |
After Width: | Height: | Size: 25 KiB |
After Width: | Height: | Size: 129 KiB |
After Width: | Height: | Size: 129 KiB |
After Width: | Height: | Size: 117 KiB |
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 135 KiB |
After Width: | Height: | Size: 135 KiB |
After Width: | Height: | Size: 130 KiB |
After Width: | Height: | Size: 129 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 124 KiB |
After Width: | Height: | Size: 107 KiB |
After Width: | Height: | Size: 105 KiB |
After Width: | Height: | Size: 139 KiB |
After Width: | Height: | Size: 117 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 97 KiB |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 139 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 179 KiB |
After Width: | Height: | Size: 166 KiB |
After Width: | Height: | Size: 136 KiB |
@ -0,0 +1,23 @@ |
|||||||
|
aniso8601==9.0.1 |
||||||
|
apispec==6.3.0 |
||||||
|
click==8.1.3 |
||||||
|
Flask==2.2.3 |
||||||
|
flask-apispec==0.11.4 |
||||||
|
Flask-Cors==3.0.10 |
||||||
|
flask-marshmallow==0.14.0 |
||||||
|
Flask-RESTful==0.3.9 |
||||||
|
Flask-SQLAlchemy==3.0.3 |
||||||
|
greenlet==2.0.2 |
||||||
|
itsdangerous==2.1.2 |
||||||
|
Jinja2==3.1.2 |
||||||
|
MarkupSafe==2.1.2 |
||||||
|
marshmallow==3.19.0 |
||||||
|
marshmallow-sqlalchemy==0.29.0 |
||||||
|
packaging==23.0 |
||||||
|
pytz==2022.7.1 |
||||||
|
six==1.16.0 |
||||||
|
SQLAlchemy==2.0.7 |
||||||
|
termcolor==2.2.0 |
||||||
|
typing_extensions==4.5.0 |
||||||
|
webargs==8.2.0 |
||||||
|
Werkzeug==2.2.3 |
After Width: | Height: | Size: 282 KiB |
After Width: | Height: | Size: 615 KiB |