Samila is a generative art generator written in Python, Samila let's you create arts based on many thousand points. The position of every single point is calculated by a formula, which has random parameters. Because of the random numbers, every image looks different.
Open Hub | ![]() |
PyPI Counter | |
Github Stars |
Branch | master | dev |
CI |
Code Quality |
pip install -r requirements.txt
or pip3 install -r requirements.txt
(Need root access)python3 setup.py install
or python setup.py install
(Need root access)pip install samila==0.4
or pip3 install samila==0.4
(Need root access)easy_install --upgrade samila
(Need root access)>>> import matplotlib.pyplot as plt
>>> from samila import GenerativeImage
>>> g = GenerativeImage()
>>> g.generate()
>>> g.plot()
>>> plt.show()
>>> import random
>>> import math
>>> def f1(x, y):
result = random.uniform(-1,1) * x**2 - math.sin(y**2) + abs(y-x)
return result
>>> def f2(x, y):
result = random.uniform(-1,1) * y**3 - math.cos(x**2) + 2*x
return result
>>> g = GenerativeImage(f1, f2)
>>> g.generate()
>>> g.plot()
>>> g.seed
188781
>>> plt.show()
>>> from samila import Projection
>>> g = GenerativeImage(f1, f2)
>>> g.generate()
>>> g.plot(projection=Projection.POLAR)
>>> g.seed
829730
>>> plt.show()
RECTILINEAR
, POLAR
, AITOFF
, HAMMER
, LAMBERT
and MOLLWEIDE
RECTILINEAR
>>> g = GenerativeImage(f1, f2)
>>> g.generate(start=-2*math.pi, step=0.01, stop=0)
>>> g.plot()
>>> g.seed
234752
>>> plt.show()
>>> g = GenerativeImage(f1, f2)
>>> g.generate()
>>> g.plot(color="yellow", bgcolor="black", projection=Projection.POLAR)
>>> g.seed
1018273
>>> plt.show()
VALID_COLORS
listcolor
and bgcolor
parameters support color name and RGB/RGBA formats>>> g = GenerativeImage(f1, f2)
>>> g.generate(seed=1018273)
>>> g.plot(projection=Projection.POLAR)
>>> plt.show()
Upload generated image directly to NFT.storage
>>> g.nft_storage(api_key=YOUR_API_KEY)
{'status': True, 'message': 'Everything seems good'}
Save generated image
>>> g.save_image(file_adr="test.png")
{'status': True, 'message': 'Everything seems good'}
Save generated image in higher resolutions
>>> g.save_image(file_adr="test.png", depth=5)
{'status': True, 'message': 'Everything seems good'}
Save generated image data
>>> g.save_data(file_adr="test.json")
So you can load it into a GenerativeImage
instance later by
>>> g = GenerativeImage(data=open('test.json', 'r'))
Save generated image config. It contains string formats of functions which is also human readable.
>>> g.save_config(file_adr="config.json")
So you can load it into a GenerativeImage
instance later by
>>> g = GenerativeImage(config=open('config.json', 'r'))
Samila is simply a transformation between a square-shaped space from the Cartesian coordinate system to any arbitrary coordination like Polar coordinate system.
We have set of points in the first space (left square) which can be define as follow:
And bellow functions are used for transformation:
>>> def f1(x, y):
result = random.uniform(-1,1) * x**2 - math.sin(y**2) + abs(y-x)
return result
>>> def f2(x, y):
result = random.uniform(-1,1) * y**3 - math.cos(x**2) + 2*x
return result
here we uses Projection.POLAR
so later space will be the polar space and we have:
>>> g = GenerativeImage(f1, f2)
>>> g.generate(seed=10)
>>> g.plot(projection=Projection.POLAR)
Just fill an issue and describe it. We'll check it ASAP!
You can also join our discord server
master | dev |
1- Schönlieb, Carola-Bibiane, and Franz Schubert. "Random simulations for generative art construction–some examples." Journal of Mathematics and the Arts 7.1 (2013): 29-39.
2- Create Generative Art with R
3- NFT.storage : Free decentralized storage and bandwidth for NFTs
Give a ⭐️ if this project helped you!
If you do like our project and we hope that you do, can you please support us? Our project is not and is never going to be working for profit. We need the money just so we can continue doing what we do ;-) .
FBL is tool to find broken links in articles and files
🎨 ASCII art library for Python
Multi-class confusion matrix library in Python
solve all cs Course for python
solve some fun problem in python
Coefficient of Variation (CV) and Coefficient of Quartile Variation (CQV) with Confidence Intervals (CI). Python port of https://github.com/MaaniBeigy/cvcqv)
This repository presents a full process of training a vehicle tracking model using `deep-person-reid` repository. Further, a complete web-application service based on FastAPI is provided that extracts features using YoloV5 and trained model.
A toolkit full of handy functions including most used models and utilities for deep-learning practitioners!