Skip to main content

Generative ART

Project description


Samila


built with Python3 PyPI version

Table of contents

Overview

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 codebeat badge CodeFactor

Installation

Source code

  • Download Version 0.2 or Latest Source
  • Run pip install -r requirements.txt or pip3 install -r requirements.txt (Need root access)
  • Run python3 setup.py install or python setup.py install (Need root access)

PyPI

Easy install

  • Run easy_install --upgrade samila (Need root access)

Usage

Basic

>>> import random
>>> import math
>>> import matplotlib.pyplot as plt
>>> from samila import GenerativeImage
>>> 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()

Projection

>>> from samila import Projection
>>> g = GenerativeImage(f1,f2)
>>> g.generate()
>>> g.plot(projection=Projection.POLAR)
>>> g.seed
829730
>>> plt.show()
  • Supported projections : RECTILINEAR, POLAR, AITOFF, HAMMER, LAMBERT and MOLLWEIDE
  • Default projection is RECTILINEAR

Range

>>> g = GenerativeImage(f1,f2)
>>> g.generate(start = -2*math.pi,step=0.1,stop=0)
>>> g.plot()
>>> g.seed
234752
>>> plt.show()

Color

>>> g = GenerativeImage(f1,f2)
>>> g.generate()
>>> g.plot(color="yellow",bgcolor="black",projection=Projection.POLAR)
>>> g.seed
1018273
>>> plt.show()
  • Supported colors are available in VALID_COLORS list
  • color and bgcolor parameters support color name and RGB/RGBA formats

Regeneration

>>> g = GenerativeImage(f1,f2)
>>> g.generate(seed=1018273)
>>> g.plot(projection=Projection.POLAR)
>>> plt.show()

NFT.storage

Upload generated image directly to NFT.storage

>>> g.nft_storage(api_key = YOUR_API_KEY)
{'status': True, 'message': 'Everything seems good'}

Save

Save generated image

>>> g.save_image(file_adr="test.png")
{'status': True, 'message': 'Everything seems good'}

Mathematical details

Samila is simply a transformation between a square-shaped space from the Cartesian coordinate system to any arbitrary coordination like Polar coordinate system.

Example

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)

Issues & bug reports

Just fill an issue and describe it. We'll check it ASAP! or send an email to info@4r7.ir.

  • Please complete the issue template

Dependencies

master dev
Requirements Status Requirements Status

References

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

Show your support

Star this repo

Give a ⭐️ if this project helped you!

Donate to our project

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 ;-) .

Bitcoin

1KtNLEEeUbTEK9PdN6Ya3ZAKXaqoKUuxCy

Ethereum

0xcD4Db18B6664A9662123D4307B074aE968535388

Litecoin

Ldnz5gMcEeV8BAdsyf8FstWDC6uyYR6pgZ

Doge

DDUnKpFQbBqLpFVZ9DfuVysBdr249HxVDh

Tron

TCZxzPZLcJHr2qR3uPUB1tXB6L3FDSSAx7

Ripple

rN7ZuRG7HDGHR5nof8nu5LrsbmSB61V1qq

Binance Coin

bnb1zglwcf0ac3d0s2f6ck5kgwvcru4tlctt4p5qef

Tether

0xcD4Db18B6664A9662123D4307B074aE968535388

Dash

Xd3Yn2qZJ7VE8nbKw2fS98aLxR5M6WUU3s

Stellar

GALPOLPISRHIYHLQER2TLJRGUSZH52RYDK6C3HIU4PSMNAV65Q36EGNL

Zilliqa

zil1knmz8zj88cf0exr2ry7nav9elehxfcgqu3c5e5

Coffeete

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Unreleased

0.2 - 2021-10-14

Added

  • dependabot.yml
  • requirements-splitter.py
  • samila_help function
  • test.py
  • function_test.py
  • is_same_data function
  • save_image method

Changed

  • dev-requirements.txt updated
  • README.md updated
  • __main__.py updated
  • test.yml updated
  • nft_storage method updated

0.1 - 2021-09-30

Added

  • GenerativeImage class
  • plot method
  • generate method
  • nft_storage method

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

samila-0.2.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

samila-0.2-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file samila-0.2.tar.gz.

File metadata

  • Download URL: samila-0.2.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for samila-0.2.tar.gz
Algorithm Hash digest
SHA256 9c5c4e5979c097f6f440c3d4687dca196c5af4ea0bbf3370a4697a377806721a
MD5 de94c70f28c5d9e97a8ec7456202e31f
BLAKE2b-256 9836c9ae9ea165d11796cfec08571641e12e83d7d7feb1023c44a03259229682

See more details on using hashes here.

File details

Details for the file samila-0.2-py3-none-any.whl.

File metadata

  • Download URL: samila-0.2-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for samila-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f650149b5bdc81d43aa67de45f742f2c683d40f9964dd2d09a4a2a1f1ad4d6f1
MD5 f6e8da862898da747fad3de4780f594a
BLAKE2b-256 6d3c9d9e37dbf3fda6c80ccaf89a29d76bd025b0f925828732aa58fe2ee9d5e5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page