Pyaesthetics (formlerly known as PrettyWebsite) is a python package designed to estimate visual features concerning the aesthetic appearance of a still image.
The module can estimate the following features:
- Brightness (in both the BT709 and BT601 standards)
- Visual Complexity (either by using the weight of the image or by Quadratic Tree Decomposition)
- Simmetry (using Quadratic Tree Decomposition)
- Colorfulness (in both the HSV and RGB color spaces)
- Presence and number of human faces
- Color distribution
- Number of images within the image
- Surface of visual and textual areas within the image
- Ratio between visual and textual areas
pyaesthetics can be installed using pip:
pip install pyaesthetics
or manually by downloading or cloning the repository and, from the root folder of the project, running:
python setup.py pyaesthetics
pyaeshtetics modules can be used one at the time to estimate one specific feature, or they can be automatically called using an automated entrypoint that calls all the available modules at once.
Example 1: one single feature (e.g. Brigthness BT601)
#load only the neede functions from the specific module from pyaesthetics.brightness import relativeLuminance_BT601, sRGB2RGB import cv2 #to open and handle images img = "/path/to/image/image.jpg" #path to a sample image img = cv2.imread(img) #load the image img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) #convert to the RGB colorscheme img = sRGB2RGB(img) #convert pixels to their linear RGB values print(relativeLuminance_BT601(img)) #evaluate luminance on the BT601 standard
Example 2: Complete analysis
import pyaesthetics img = "/path/to/image/image.jpg" #path to a sample image results = pyaesthetics.analyzeImage(img) #perform all the availabe analysis using standard parameters print(results)
You can check the full documentation here: https://pyaesthetics.rtfd.io (not available yet)
Scientific Publications using pyaesthetic
- Gabrieli, G., Bornstein, M. H., Setoh, P., & Esposito, G. (2022). Machine learning estimation of users’ implicit and explicit aesthetic judgments of web-pages. Behaviour & Information Technology, 1-11.
The project has been sponsored by Gitkraken.