duotonics 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.
- duotonics-1.0.0/LICENSE +21 -0
- duotonics-1.0.0/PKG-INFO +152 -0
- duotonics-1.0.0/README.md +122 -0
- duotonics-1.0.0/duotone_generator.py +993 -0
- duotonics-1.0.0/duotonics.egg-info/PKG-INFO +152 -0
- duotonics-1.0.0/duotonics.egg-info/SOURCES.txt +11 -0
- duotonics-1.0.0/duotonics.egg-info/dependency_links.txt +1 -0
- duotonics-1.0.0/duotonics.egg-info/entry_points.txt +2 -0
- duotonics-1.0.0/duotonics.egg-info/requires.txt +2 -0
- duotonics-1.0.0/duotonics.egg-info/top_level.txt +1 -0
- duotonics-1.0.0/pyproject.toml +54 -0
- duotonics-1.0.0/requirements.txt +2 -0
- duotonics-1.0.0/setup.cfg +4 -0
duotonics-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 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.
|
duotonics-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: duotonics
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Reproducible duotone image processing with OpenCV and NumPy, available as a Python CLI, library, and tkinter GUI.
|
|
5
|
+
Author: Michail Semoglou
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/MichailSemoglou/duotonics
|
|
8
|
+
Project-URL: Repository, https://github.com/MichailSemoglou/duotonics
|
|
9
|
+
Project-URL: Issues, https://github.com/MichailSemoglou/duotonics/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/MichailSemoglou/duotonics/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: duotone,image-processing,opencv,numpy,color
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Image Processing
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: opencv-python-headless<5,>=4.5.5
|
|
28
|
+
Requires-Dist: numpy<3,>=1.22
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# Duotonics
|
|
32
|
+
|
|
33
|
+
[](https://github.com/MichailSemoglou/duotonics/actions/workflows/tests.yml)
|
|
34
|
+
[](https://github.com/MichailSemoglou/duotonics/blob/main/LICENSE)
|
|
35
|
+
|
|
36
|
+
Duotonics is a Python application for reproducible two-color imaging. It blends random or explicit color pairs over a source image's tonal key in gamma-encoded sRGB (legacy), linear sRGB, or Oklab (Ottosson, 2020). It accepts JPEG, PNG, and BMP input and writes a batch of lossless PNGs (100 by default) plus `colors.csv` and `metrics.csv` sidecars. The application is usable through file dialogs, a command-line interface, or as a Python library.
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- Image selection via a file dialog
|
|
41
|
+
- Generates 100 duotone variations as lossless **PNG** files (count configurable)
|
|
42
|
+
- Filenames use **hex color codes** in RGB order (e.g. `083_2CD2B4_DC1E5A.png`), ready to paste into Figma, Illustrator, or your design system
|
|
43
|
+
- Produces a **`colors.csv` sidecar** listing every variation's color pair for easy reference and sharing
|
|
44
|
+
- Produces a **`metrics.csv` sidecar** reporting mean, median, and 95th-percentile CIEDE2000 (Sharma, Wu & Dalal, 2005) for every variation against its Oklab-rendered perceptual reference
|
|
45
|
+
- Command-line mode with reproducible batches (`--seed`), configurable variation count (`--count`), explicit color pairs (`--colors`), and blend space (`--space srgb|linear|oklab`)
|
|
46
|
+
- Uses OpenCV for efficient image processing
|
|
47
|
+
|
|
48
|
+
## Example batch
|
|
49
|
+
|
|
50
|
+
One source photograph, 100 duotone variations generated with `--count 100 --seed 42 --space oklab`:
|
|
51
|
+
|
|
52
|
+

|
|
53
|
+
|
|
54
|
+
Source: NASA's photograph of astronaut Eileen Collins, public domain, from the [scikit-image `astronaut` dataset](https://scikit-image.org/docs/stable/api/skimage.data.html#skimage.data.astronaut).
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
Duotonics requires Python 3.9 or higher. Install it from a source checkout:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
git clone https://github.com/MichailSemoglou/duotonics.git
|
|
62
|
+
cd duotonics
|
|
63
|
+
python -m pip install .
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
This installs the `duotonics` command and the `duotone_generator` Python module. After the PyPI release, installation will also be available with `python -m pip install duotonics`.
|
|
67
|
+
|
|
68
|
+
## Usage
|
|
69
|
+
|
|
70
|
+
### Interactive mode
|
|
71
|
+
|
|
72
|
+
Run the command without arguments:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
duotonics
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Direct script execution remains available from a source checkout:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
python3 duotone_generator.py
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
1. A file dialog will open. Select the image you want to process, then choose an output directory.
|
|
85
|
+
|
|
86
|
+
2. The script will generate 100 duotone variations in a new folder named `[original_filename]_duotone_variations`. Each variation is a lossless PNG file named after its two hex color values (e.g. `083_2CD2B4_DC1E5A.png`). A `colors.csv` file is also written to the same folder, listing every variation's color pair.
|
|
87
|
+
|
|
88
|
+
3. A message box will appear when the process is complete, indicating the location of the output folder.
|
|
89
|
+
|
|
90
|
+
### Command-line mode
|
|
91
|
+
|
|
92
|
+
Pass the image path as an argument to run without any dialogs, suitable for scripting and headless environments:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
duotonics path/to/image.png [--output-dir DIR] [--count N] [--seed S] [--colors "HEX1,HEX2"] [--space {srgb,linear,oklab}]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
- `-o, --output-dir DIR`: place the output folder under DIR instead of alongside the source image.
|
|
99
|
+
- `--count N`: number of random variations (default: 100).
|
|
100
|
+
- `--seed S`: reproduce a batch exactly by reusing its seed.
|
|
101
|
+
- `--colors "#2CD2B4,#DC1E5A"`: apply explicit color pairs instead of random ones; repeatable, one variation per pair. Cannot be combined with `--count` or `--seed`.
|
|
102
|
+
- `--space {srgb,linear,oklab}`: where the blend runs. `srgb` (default) is the legacy gamma-space blend. `linear` blends linear light (IEC 61966-2-1; Poynton, 2003) and `oklab` blends in Oklab (Ottosson, 2020); both derive the key from ITU-R BT.709 relative luminance instead of grayscale luma.
|
|
103
|
+
|
|
104
|
+
The location of the output folder is printed on completion.
|
|
105
|
+
|
|
106
|
+
### Library use
|
|
107
|
+
|
|
108
|
+
The module can be imported and used as a library, without tkinter installed:
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
from duotone_generator import convert_to_duotone
|
|
112
|
+
|
|
113
|
+
folder, records = convert_to_duotone("photo.png", count=25, seed=42, space="oklab")
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
It returns the output folder path and a list of `[index, color_1_hex, color_2_hex]` records, one per variation. Each batch also writes `metrics.csv`, whose rows report the mean, median, and 95th-percentile CIEDE2000 (Sharma, Wu & Dalal, 2005) between that variation and its perceptual reference, defined as the same color pair blended in Oklab over the same key. See the `convert_to_duotone` docstring for all parameters.
|
|
117
|
+
|
|
118
|
+
## Dependencies
|
|
119
|
+
|
|
120
|
+
- OpenCV (cv2)
|
|
121
|
+
- NumPy
|
|
122
|
+
- Tkinter (usually comes pre-installed with Python; only needed for interactive mode)
|
|
123
|
+
|
|
124
|
+
## Requirements
|
|
125
|
+
|
|
126
|
+
- Python 3.9 or higher
|
|
127
|
+
|
|
128
|
+
## Development
|
|
129
|
+
|
|
130
|
+
Install the package in editable mode with its development dependencies, then run the test suite with coverage:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
python -m pip install -e . -r requirements-dev.txt
|
|
134
|
+
pytest --cov --cov-report=term-missing
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Build and check the wheel and source distribution with:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
python -m build
|
|
141
|
+
python -m twine check dist/*
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Community
|
|
145
|
+
|
|
146
|
+
- [Contribution guide](https://github.com/MichailSemoglou/duotonics/blob/main/CONTRIBUTING.md)
|
|
147
|
+
- [Code of conduct](https://github.com/MichailSemoglou/duotonics/blob/main/CODE_OF_CONDUCT.md)
|
|
148
|
+
- [Security policy](https://github.com/MichailSemoglou/duotonics/blob/main/SECURITY.md)
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
MIT. See the [LICENSE](https://github.com/MichailSemoglou/duotonics/blob/main/LICENSE) file for details.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Duotonics
|
|
2
|
+
|
|
3
|
+
[](https://github.com/MichailSemoglou/duotonics/actions/workflows/tests.yml)
|
|
4
|
+
[](https://github.com/MichailSemoglou/duotonics/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
Duotonics is a Python application for reproducible two-color imaging. It blends random or explicit color pairs over a source image's tonal key in gamma-encoded sRGB (legacy), linear sRGB, or Oklab (Ottosson, 2020). It accepts JPEG, PNG, and BMP input and writes a batch of lossless PNGs (100 by default) plus `colors.csv` and `metrics.csv` sidecars. The application is usable through file dialogs, a command-line interface, or as a Python library.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- Image selection via a file dialog
|
|
11
|
+
- Generates 100 duotone variations as lossless **PNG** files (count configurable)
|
|
12
|
+
- Filenames use **hex color codes** in RGB order (e.g. `083_2CD2B4_DC1E5A.png`), ready to paste into Figma, Illustrator, or your design system
|
|
13
|
+
- Produces a **`colors.csv` sidecar** listing every variation's color pair for easy reference and sharing
|
|
14
|
+
- Produces a **`metrics.csv` sidecar** reporting mean, median, and 95th-percentile CIEDE2000 (Sharma, Wu & Dalal, 2005) for every variation against its Oklab-rendered perceptual reference
|
|
15
|
+
- Command-line mode with reproducible batches (`--seed`), configurable variation count (`--count`), explicit color pairs (`--colors`), and blend space (`--space srgb|linear|oklab`)
|
|
16
|
+
- Uses OpenCV for efficient image processing
|
|
17
|
+
|
|
18
|
+
## Example batch
|
|
19
|
+
|
|
20
|
+
One source photograph, 100 duotone variations generated with `--count 100 --seed 42 --space oklab`:
|
|
21
|
+
|
|
22
|
+

|
|
23
|
+
|
|
24
|
+
Source: NASA's photograph of astronaut Eileen Collins, public domain, from the [scikit-image `astronaut` dataset](https://scikit-image.org/docs/stable/api/skimage.data.html#skimage.data.astronaut).
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
Duotonics requires Python 3.9 or higher. Install it from a source checkout:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
git clone https://github.com/MichailSemoglou/duotonics.git
|
|
32
|
+
cd duotonics
|
|
33
|
+
python -m pip install .
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This installs the `duotonics` command and the `duotone_generator` Python module. After the PyPI release, installation will also be available with `python -m pip install duotonics`.
|
|
37
|
+
|
|
38
|
+
## Usage
|
|
39
|
+
|
|
40
|
+
### Interactive mode
|
|
41
|
+
|
|
42
|
+
Run the command without arguments:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
duotonics
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Direct script execution remains available from a source checkout:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python3 duotone_generator.py
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
1. A file dialog will open. Select the image you want to process, then choose an output directory.
|
|
55
|
+
|
|
56
|
+
2. The script will generate 100 duotone variations in a new folder named `[original_filename]_duotone_variations`. Each variation is a lossless PNG file named after its two hex color values (e.g. `083_2CD2B4_DC1E5A.png`). A `colors.csv` file is also written to the same folder, listing every variation's color pair.
|
|
57
|
+
|
|
58
|
+
3. A message box will appear when the process is complete, indicating the location of the output folder.
|
|
59
|
+
|
|
60
|
+
### Command-line mode
|
|
61
|
+
|
|
62
|
+
Pass the image path as an argument to run without any dialogs, suitable for scripting and headless environments:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
duotonics path/to/image.png [--output-dir DIR] [--count N] [--seed S] [--colors "HEX1,HEX2"] [--space {srgb,linear,oklab}]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- `-o, --output-dir DIR`: place the output folder under DIR instead of alongside the source image.
|
|
69
|
+
- `--count N`: number of random variations (default: 100).
|
|
70
|
+
- `--seed S`: reproduce a batch exactly by reusing its seed.
|
|
71
|
+
- `--colors "#2CD2B4,#DC1E5A"`: apply explicit color pairs instead of random ones; repeatable, one variation per pair. Cannot be combined with `--count` or `--seed`.
|
|
72
|
+
- `--space {srgb,linear,oklab}`: where the blend runs. `srgb` (default) is the legacy gamma-space blend. `linear` blends linear light (IEC 61966-2-1; Poynton, 2003) and `oklab` blends in Oklab (Ottosson, 2020); both derive the key from ITU-R BT.709 relative luminance instead of grayscale luma.
|
|
73
|
+
|
|
74
|
+
The location of the output folder is printed on completion.
|
|
75
|
+
|
|
76
|
+
### Library use
|
|
77
|
+
|
|
78
|
+
The module can be imported and used as a library, without tkinter installed:
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
from duotone_generator import convert_to_duotone
|
|
82
|
+
|
|
83
|
+
folder, records = convert_to_duotone("photo.png", count=25, seed=42, space="oklab")
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
It returns the output folder path and a list of `[index, color_1_hex, color_2_hex]` records, one per variation. Each batch also writes `metrics.csv`, whose rows report the mean, median, and 95th-percentile CIEDE2000 (Sharma, Wu & Dalal, 2005) between that variation and its perceptual reference, defined as the same color pair blended in Oklab over the same key. See the `convert_to_duotone` docstring for all parameters.
|
|
87
|
+
|
|
88
|
+
## Dependencies
|
|
89
|
+
|
|
90
|
+
- OpenCV (cv2)
|
|
91
|
+
- NumPy
|
|
92
|
+
- Tkinter (usually comes pre-installed with Python; only needed for interactive mode)
|
|
93
|
+
|
|
94
|
+
## Requirements
|
|
95
|
+
|
|
96
|
+
- Python 3.9 or higher
|
|
97
|
+
|
|
98
|
+
## Development
|
|
99
|
+
|
|
100
|
+
Install the package in editable mode with its development dependencies, then run the test suite with coverage:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
python -m pip install -e . -r requirements-dev.txt
|
|
104
|
+
pytest --cov --cov-report=term-missing
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Build and check the wheel and source distribution with:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
python -m build
|
|
111
|
+
python -m twine check dist/*
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Community
|
|
115
|
+
|
|
116
|
+
- [Contribution guide](https://github.com/MichailSemoglou/duotonics/blob/main/CONTRIBUTING.md)
|
|
117
|
+
- [Code of conduct](https://github.com/MichailSemoglou/duotonics/blob/main/CODE_OF_CONDUCT.md)
|
|
118
|
+
- [Security policy](https://github.com/MichailSemoglou/duotonics/blob/main/SECURITY.md)
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
|
|
122
|
+
MIT. See the [LICENSE](https://github.com/MichailSemoglou/duotonics/blob/main/LICENSE) file for details.
|