Skip to main content

Images aesthetic analysis

Project description

Logo

pyaesthetics

GitHub release PyPI PyPI pyversions PyPI status PyPI downloads Downloads Documentation Status DOI

Pyaesthetics (formlerly known as PrettyWebsite) is a python package designed to estimate visual features concerning the aesthetic appearance of a still image.

Features

The module can estimate the following features:

  • Brightness (in both the BT709 and BT601 standards)
  • Contrast (RMS or Michelson contrast)
  • Saturation
  • 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

Installation

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

Tesseract and pytesseract

Tesseract and pytesseract are also required. To install tesseract please visit: https://tesseract-ocr.github.io/tessdoc/Installation.html

Updating the package

To update the package via pip, you can use:

pip install --user --upgrade pyaesthetics

Example

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.analysis.analyzeImage(img, method="complete") #perform all the availabe analysis using standard parameters
print(results)

Or for a faster analysis:

import pyaesthetics
img = "/path/to/image/image.jpg" #path to a sample image
results = pyaesthetics.analysis.analyzeImage(img, method="fast") #perform a subset of the analysis using standard parameters.
print(results)

Documentation

You can check the full documentation here: https://prettywebsite.readthedocs.io/en/latest/

Requirements

  • numpy
  • scipy
  • matplotlib
  • pandas
  • opencv-python
  • imutils
  • pytesseract

Contacts

Feel free to contact me for questions, suggestions or to give me advice as well at: giulio.gabrieli@iit.it or giulio@duck.com

Scientific Publications that used pyaesthetic

  • Gabrieli G. (2018), Using users' physiological response to predict aesthetic experience of websites, Master Degree in Human-Computer Interaction, University of Trento (Italy)
  • 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.
  • Bizzego, A., Gabrieli, G., Azhari, A., Lim, M., & Esposito, G. (2022). Dataset of parent-child hyperscanning functional near-infrared spectroscopy recordings. Scientific Data, 9(1), 625.
  • Cianfanelli, B., Esposito, A., Spataro, P., Santirocchi, A., Cestari, V., Rossi-Arnaud, C., & Costanzi, M. (2023). The binding of negative emotional stimuli with spatial information in working memory: A possible role for the episodic buffer. Frontiers in Neuroscience, 17, 445.
  • Music A., Maerten A., Wagemans J. (2023).Beautification of images by generative adversarial networks. Journal of Vision 2023;23(10):14.
  • Veldhuizen M. (2024), Analyzing the Role of Aesthetic Features in Packaging Designs on Consumer Responses: The Case of Specialty Coffee, Master Degree in Communication Science, Vrije Universiteit (Netherlands)

Presentation

  • Gabrieli, G., Scapin, G., & Esposito, G. (2022). Pyaesthetic, a python package for empirical aesthetic analysis. XXVII Conference of the International Association of Empirical Aesthetics, Philadelphia, United States. https://giuliogabrieli.it/posters/iaea2022/

Sponsors

The project has been sponsored by Gitkraken.

Coffee?

Buy Me a Coffee at ko-fi.com

Download files

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

Source Distribution

pyaesthetics-0.0.8.2.tar.gz (11.5 MB view hashes)

Uploaded Source

Built Distribution

pyaesthetics-0.0.8.2-py3-none-any.whl (11.5 MB view hashes)

Uploaded Python 3

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