color-analysis-tool 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- color_analysis_tool-1.0.0/.gitignore +182 -0
- color_analysis_tool-1.0.0/CHANGELOG.md +51 -0
- color_analysis_tool-1.0.0/CITATION.cff +39 -0
- color_analysis_tool-1.0.0/LICENSE +21 -0
- color_analysis_tool-1.0.0/PKG-INFO +272 -0
- color_analysis_tool-1.0.0/README.md +223 -0
- color_analysis_tool-1.0.0/color_analysis_tool/__init__.py +47 -0
- color_analysis_tool-1.0.0/color_analysis_tool/analyzer.py +345 -0
- color_analysis_tool-1.0.0/color_analysis_tool/cli.py +116 -0
- color_analysis_tool-1.0.0/pyproject.toml +112 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
|
|
110
|
+
# pdm
|
|
111
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
112
|
+
#pdm.lock
|
|
113
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
114
|
+
# in version control.
|
|
115
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
|
116
|
+
.pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
121
|
+
__pypackages__/
|
|
122
|
+
|
|
123
|
+
# Celery stuff
|
|
124
|
+
celerybeat-schedule
|
|
125
|
+
celerybeat.pid
|
|
126
|
+
|
|
127
|
+
# SageMath parsed files
|
|
128
|
+
*.sage.py
|
|
129
|
+
|
|
130
|
+
# Environments
|
|
131
|
+
.env
|
|
132
|
+
.venv
|
|
133
|
+
env/
|
|
134
|
+
venv/
|
|
135
|
+
ENV/
|
|
136
|
+
env.bak/
|
|
137
|
+
venv.bak/
|
|
138
|
+
|
|
139
|
+
# Spyder project settings
|
|
140
|
+
.spyderproject
|
|
141
|
+
.spyproject
|
|
142
|
+
|
|
143
|
+
# Rope project settings
|
|
144
|
+
.ropeproject
|
|
145
|
+
|
|
146
|
+
# mkdocs documentation
|
|
147
|
+
/site
|
|
148
|
+
|
|
149
|
+
# mypy
|
|
150
|
+
.mypy_cache/
|
|
151
|
+
.dmypy.json
|
|
152
|
+
dmypy.json
|
|
153
|
+
|
|
154
|
+
# Pyre type checker
|
|
155
|
+
.pyre/
|
|
156
|
+
|
|
157
|
+
# pytype static type analyzer
|
|
158
|
+
.pytype/
|
|
159
|
+
|
|
160
|
+
# Cython debug symbols
|
|
161
|
+
cython_debug/
|
|
162
|
+
|
|
163
|
+
# PyCharm
|
|
164
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
165
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
166
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
167
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
168
|
+
#.idea/
|
|
169
|
+
|
|
170
|
+
# PyPI configuration file
|
|
171
|
+
.pypirc
|
|
172
|
+
|
|
173
|
+
# Project-specific
|
|
174
|
+
output/
|
|
175
|
+
new/
|
|
176
|
+
*.jpg
|
|
177
|
+
*.jpeg
|
|
178
|
+
*.png
|
|
179
|
+
*.tiff
|
|
180
|
+
*.webp
|
|
181
|
+
*.psd
|
|
182
|
+
!test_images/
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [1.0.0] - 2025-01-01
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Initial stable release
|
|
14
|
+
- Comprehensive color analysis for images
|
|
15
|
+
- Multiple color space support (RGB, HEX, CMYK)
|
|
16
|
+
- Color harmony calculations:
|
|
17
|
+
- Complementary colors (180° hue offset)
|
|
18
|
+
- Analogous colors (±30° hue offset)
|
|
19
|
+
- Triadic colors (120° hue spacing)
|
|
20
|
+
- Tetradic colors (90° hue spacing)
|
|
21
|
+
- Multiple sorting options for colors:
|
|
22
|
+
- By frequency (default)
|
|
23
|
+
- By hue
|
|
24
|
+
- By saturation
|
|
25
|
+
- By brightness
|
|
26
|
+
- Dominant color detection
|
|
27
|
+
- Batch processing with recursive directory scanning
|
|
28
|
+
- Support for multiple image formats:
|
|
29
|
+
- PNG
|
|
30
|
+
- JPG/JPEG
|
|
31
|
+
- TIFF
|
|
32
|
+
- WebP
|
|
33
|
+
- PSD
|
|
34
|
+
- Command-line interface (`color-analysis` command)
|
|
35
|
+
- Python API for library usage
|
|
36
|
+
- Progress bars for batch processing
|
|
37
|
+
- Detailed text reports with full color information
|
|
38
|
+
- MIT License
|
|
39
|
+
- CITATION.cff for academic citations
|
|
40
|
+
- Zenodo integration for DOI minting
|
|
41
|
+
|
|
42
|
+
### Technical Details
|
|
43
|
+
- Built with Python 3.7+ compatibility
|
|
44
|
+
- Uses Pillow for image processing
|
|
45
|
+
- Uses colormath for color space conversions
|
|
46
|
+
- Uses tqdm for progress visualization
|
|
47
|
+
- PEP 621 compliant packaging with pyproject.toml
|
|
48
|
+
- Type hints throughout the codebase
|
|
49
|
+
|
|
50
|
+
[Unreleased]: https://github.com/MichailSemoglou/color-analysis-tool/compare/v1.0.0...HEAD
|
|
51
|
+
[1.0.0]: https://github.com/MichailSemoglou/color-analysis-tool/releases/tag/v1.0.0
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# This CITATION.cff file was generated with cffinit.
|
|
2
|
+
# Visit https://bit.ly/cffinit to generate yours today!
|
|
3
|
+
|
|
4
|
+
cff-version: 1.2.0
|
|
5
|
+
title: Color Analysis Tool
|
|
6
|
+
message: >-
|
|
7
|
+
If you use this software, please cite it using the
|
|
8
|
+
metadata from this file.
|
|
9
|
+
type: software
|
|
10
|
+
authors:
|
|
11
|
+
- given-names: Michail
|
|
12
|
+
family-names: Semoglou
|
|
13
|
+
orcid: 'https://orcid.org/0009-0003-3268-5657'
|
|
14
|
+
repository-code: 'https://github.com/MichailSemoglou/color-analysis-tool'
|
|
15
|
+
url: 'https://github.com/MichailSemoglou/color-analysis-tool'
|
|
16
|
+
abstract: >-
|
|
17
|
+
A comprehensive Python tool for analyzing colors in images,
|
|
18
|
+
providing detailed information about color distributions,
|
|
19
|
+
harmonies, and various color space conversions (RGB, HEX, CMYK).
|
|
20
|
+
Features include single image and batch processing, dominant
|
|
21
|
+
color detection, color harmony calculations (complementary,
|
|
22
|
+
analogous, triadic, tetradic), and support for multiple image
|
|
23
|
+
formats.
|
|
24
|
+
keywords:
|
|
25
|
+
- color analysis
|
|
26
|
+
- image processing
|
|
27
|
+
- color harmony
|
|
28
|
+
- design tools
|
|
29
|
+
- Python
|
|
30
|
+
- color extraction
|
|
31
|
+
- RGB
|
|
32
|
+
- CMYK
|
|
33
|
+
- HEX
|
|
34
|
+
- color space conversion
|
|
35
|
+
- batch processing
|
|
36
|
+
- dominant color detection
|
|
37
|
+
license: MIT
|
|
38
|
+
version: 1.0.0
|
|
39
|
+
date-released: '2025-01-01'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Michail Semoglou
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: color-analysis-tool
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A comprehensive tool for analyzing colors in images with harmony calculations and multiple color space conversions
|
|
5
|
+
Project-URL: Homepage, https://github.com/MichailSemoglou/color-analysis-tool
|
|
6
|
+
Project-URL: Repository, https://github.com/MichailSemoglou/color-analysis-tool
|
|
7
|
+
Project-URL: Documentation, https://github.com/MichailSemoglou/color-analysis-tool#readme
|
|
8
|
+
Project-URL: Issues, https://github.com/MichailSemoglou/color-analysis-tool/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/MichailSemoglou/color-analysis-tool/blob/main/CHANGELOG.md
|
|
10
|
+
Author: Michail Semoglou
|
|
11
|
+
Maintainer: Michail Semoglou
|
|
12
|
+
License-Expression: MIT
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Keywords: CMYK,HEX,RGB,batch processing,color,color analysis,color extraction,color harmony,color space,design tools,dominant color,image processing
|
|
15
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
16
|
+
Classifier: Environment :: Console
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
19
|
+
Classifier: Intended Audience :: Science/Research
|
|
20
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
29
|
+
Classifier: Topic :: Artistic Software
|
|
30
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
31
|
+
Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
|
|
32
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
33
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
34
|
+
Classifier: Typing :: Typed
|
|
35
|
+
Requires-Python: >=3.7
|
|
36
|
+
Requires-Dist: colormath>=3.0.0
|
|
37
|
+
Requires-Dist: pillow>=9.0.0
|
|
38
|
+
Requires-Dist: tqdm>=4.65.0
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
Requires-Dist: black>=23.0.0; extra == 'dev'
|
|
41
|
+
Requires-Dist: build>=0.10.0; extra == 'dev'
|
|
42
|
+
Requires-Dist: flake8>=6.0.0; extra == 'dev'
|
|
43
|
+
Requires-Dist: isort>=5.12.0; extra == 'dev'
|
|
44
|
+
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
45
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
46
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
47
|
+
Requires-Dist: twine>=4.0.0; extra == 'dev'
|
|
48
|
+
Description-Content-Type: text/markdown
|
|
49
|
+
|
|
50
|
+
# Image Color Analysis Tool
|
|
51
|
+
|
|
52
|
+
[](https://doi.org/YOUR_DOI_HERE)
|
|
53
|
+
[](https://badge.fury.io/py/color-analysis-tool)
|
|
54
|
+
[](https://opensource.org/licenses/MIT)
|
|
55
|
+
[](https://www.python.org/downloads/)
|
|
56
|
+
|
|
57
|
+
A powerful Python tool for analyzing colors in images, providing detailed information about color distributions, harmonies, and various color space conversions. Perfect for designers, artists, and developers working with color analysis and manipulation.
|
|
58
|
+
|
|
59
|
+
## Features
|
|
60
|
+
|
|
61
|
+
- **Comprehensive Color Analysis**: Extract and analyze colors from images
|
|
62
|
+
- **Multiple Color Spaces**: Support for RGB, HEX, and CMYK color formats
|
|
63
|
+
- **Color Harmony**: Calculate complementary, analogous, triadic, and tetradic color harmonies
|
|
64
|
+
- **Color Sorting Options**: Sort colors by frequency, hue, saturation, or brightness
|
|
65
|
+
- **Dominant Color Detection**: Automatically identify the most prominent color
|
|
66
|
+
- **Batch Processing**: Analyze multiple images recursively in directories
|
|
67
|
+
- **Detailed Reports**: Generate comprehensive analysis reports for each image
|
|
68
|
+
- **Format Support**: Works with PNG, JPG, TIFF, WebP, and PSD files
|
|
69
|
+
- **Progress Tracking**: Visual progress bars for processing status
|
|
70
|
+
- **CLI and API**: Use as a command-line tool or import as a Python library
|
|
71
|
+
|
|
72
|
+
## Installation
|
|
73
|
+
|
|
74
|
+
### From PyPI (Recommended)
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install color-analysis-tool
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### From Source
|
|
81
|
+
|
|
82
|
+
1. Clone the repository:
|
|
83
|
+
```bash
|
|
84
|
+
git clone https://github.com/MichailSemoglou/color-analysis-tool.git
|
|
85
|
+
cd color-analysis-tool
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
2. Create and activate a virtual environment (recommended):
|
|
89
|
+
```bash
|
|
90
|
+
python -m venv venv
|
|
91
|
+
source venv/bin/activate # On Windows, use: venv\Scripts\activate
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
3. Install the package:
|
|
95
|
+
```bash
|
|
96
|
+
# For regular use
|
|
97
|
+
pip install .
|
|
98
|
+
|
|
99
|
+
# For development (editable install with dev dependencies)
|
|
100
|
+
pip install -e ".[dev]"
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Usage
|
|
104
|
+
|
|
105
|
+
### Command Line Interface
|
|
106
|
+
|
|
107
|
+
After installation, you can use the `color-analysis` command:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Analyze a single image
|
|
111
|
+
color-analysis path/to/image.jpg output/directory
|
|
112
|
+
|
|
113
|
+
# Process all images in a directory
|
|
114
|
+
color-analysis path/to/image/directory output/directory
|
|
115
|
+
|
|
116
|
+
# Enable verbose logging
|
|
117
|
+
color-analysis path/to/image.jpg output/directory -v
|
|
118
|
+
|
|
119
|
+
# Sort colors by different criteria
|
|
120
|
+
color-analysis path/to/image.jpg output/directory -s hue
|
|
121
|
+
color-analysis path/to/image.jpg output/directory -s saturation
|
|
122
|
+
color-analysis path/to/image.jpg output/directory -s brightness
|
|
123
|
+
|
|
124
|
+
# Show version
|
|
125
|
+
color-analysis --version
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Python API
|
|
129
|
+
|
|
130
|
+
You can also use the tool as a library in your Python projects:
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
from color_analysis_tool import ImageAnalyzer
|
|
134
|
+
|
|
135
|
+
analyzer = ImageAnalyzer()
|
|
136
|
+
|
|
137
|
+
# Analyze a single image with custom sorting
|
|
138
|
+
image_info = analyzer.analyze_image('path/to/image.jpg', sort_by='hue')
|
|
139
|
+
|
|
140
|
+
# Save the analysis
|
|
141
|
+
analyzer.save_analysis('output/directory', image_info)
|
|
142
|
+
|
|
143
|
+
# Process multiple images recursively
|
|
144
|
+
analyzer.batch_process('input/directory', 'output/directory', sort_by='frequency')
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### Working with Analysis Results
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from color_analysis_tool import ImageAnalyzer, ColorConverter, ColorHarmony
|
|
151
|
+
|
|
152
|
+
analyzer = ImageAnalyzer()
|
|
153
|
+
image_info = analyzer.analyze_image('photo.jpg')
|
|
154
|
+
|
|
155
|
+
# Access image metadata
|
|
156
|
+
print(f"Image: {image_info.filename}")
|
|
157
|
+
print(f"Dimensions: {image_info.dimensions}")
|
|
158
|
+
print(f"Dominant color: {image_info.dominant_color}")
|
|
159
|
+
|
|
160
|
+
# Iterate through colors
|
|
161
|
+
for color in image_info.colors[:10]: # Top 10 colors
|
|
162
|
+
print(f"RGB: {color.rgb}, HEX: {color.hex}, Frequency: {color.frequency}%")
|
|
163
|
+
print(f" Complementary: {color.harmonies['complementary']}")
|
|
164
|
+
|
|
165
|
+
# Use utility classes directly
|
|
166
|
+
converter = ColorConverter()
|
|
167
|
+
cmyk = converter.rgb_to_cmyk(255, 128, 64)
|
|
168
|
+
|
|
169
|
+
harmony = ColorHarmony()
|
|
170
|
+
harmonies = harmony.find_harmonies((255, 128, 64))
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### Example Output
|
|
174
|
+
|
|
175
|
+
The tool generates a detailed analysis file for each image with the following information:
|
|
176
|
+
- Image metadata (dimensions, format)
|
|
177
|
+
- Dominant color information
|
|
178
|
+
- Color frequency analysis with sorting options
|
|
179
|
+
- RGB, HEX, and CMYK values for each significant color
|
|
180
|
+
- Color harmonies for each major color
|
|
181
|
+
|
|
182
|
+
Example output structure:
|
|
183
|
+
```
|
|
184
|
+
Image Analysis for example.jpg
|
|
185
|
+
Dimensions: 1920x1080
|
|
186
|
+
Format: JPEG
|
|
187
|
+
Dominant Color: RGB(255, 255, 255)
|
|
188
|
+
|
|
189
|
+
Colors (sorted by frequency):
|
|
190
|
+
RGB: (255, 255, 255), HEX: #FFFFFF, CMYK: (0, 0, 0, 0), Frequency: 35.2%
|
|
191
|
+
Harmonies:
|
|
192
|
+
Complementary: [(0, 0, 0)]
|
|
193
|
+
Analogous: [(255, 245, 245), (255, 255, 255), (245, 255, 255)]
|
|
194
|
+
Triadic: [(255, 255, 0), (255, 255, 255), (0, 255, 255)]
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Requirements
|
|
198
|
+
|
|
199
|
+
- Python 3.7 or higher
|
|
200
|
+
- Pillow >= 9.0.0
|
|
201
|
+
- tqdm >= 4.65.0
|
|
202
|
+
- colormath >= 3.0.0
|
|
203
|
+
|
|
204
|
+
## Citation
|
|
205
|
+
|
|
206
|
+
If you use this software in your research, please cite it using the metadata in [CITATION.cff](CITATION.cff):
|
|
207
|
+
|
|
208
|
+
```bibtex
|
|
209
|
+
@software{semoglou_color_analysis_tool,
|
|
210
|
+
author = {Semoglou, Michail},
|
|
211
|
+
title = {Color Analysis Tool},
|
|
212
|
+
version = {1.0.0},
|
|
213
|
+
year = {2025},
|
|
214
|
+
url = {https://github.com/MichailSemoglou/color-analysis-tool},
|
|
215
|
+
doi = {YOUR_DOI_HERE}
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Contributing
|
|
220
|
+
|
|
221
|
+
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
|
|
222
|
+
|
|
223
|
+
1. Fork the repository
|
|
224
|
+
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
|
|
225
|
+
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
226
|
+
4. Push to the branch (`git push origin feature/AmazingFeature`)
|
|
227
|
+
5. Open a Pull Request
|
|
228
|
+
|
|
229
|
+
### Development Setup
|
|
230
|
+
|
|
231
|
+
1. Clone your fork:
|
|
232
|
+
```bash
|
|
233
|
+
git clone https://github.com/YOUR_USERNAME/color-analysis-tool.git
|
|
234
|
+
cd color-analysis-tool
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
2. Set up development environment:
|
|
238
|
+
```bash
|
|
239
|
+
python -m venv venv
|
|
240
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
241
|
+
pip install -e ".[dev]"
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
3. Run tests:
|
|
245
|
+
```bash
|
|
246
|
+
pytest
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
4. Format code:
|
|
250
|
+
```bash
|
|
251
|
+
black color_analysis_tool/
|
|
252
|
+
isort color_analysis_tool/
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
5. Type checking:
|
|
256
|
+
```bash
|
|
257
|
+
mypy color_analysis_tool/
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## License
|
|
261
|
+
|
|
262
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
263
|
+
|
|
264
|
+
## Acknowledgments
|
|
265
|
+
|
|
266
|
+
- [Pillow](https://python-pillow.org/) for image processing capabilities
|
|
267
|
+
- [colormath](https://python-colormath.readthedocs.io/) for color space conversions
|
|
268
|
+
- [tqdm](https://github.com/tqdm/tqdm) for progress bar functionality
|
|
269
|
+
|
|
270
|
+
## Changelog
|
|
271
|
+
|
|
272
|
+
See [CHANGELOG.md](CHANGELOG.md) for a history of changes to this project.
|