autolevels 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.
@@ -0,0 +1,130 @@
1
+ Metadata-Version: 2.3
2
+ Name: autolevels
3
+ Version: 1.0.0
4
+ Summary: A tool for automatic photo enhancement using curve corrections.
5
+ Author-email: Marius Wanko <marius.wanko@gmail.com>
6
+ Requires-Python: >=3.9
7
+ Description-Content-Type: text/markdown
8
+ Classifier: Programming Language :: Python :: 3.9
9
+ Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Topic :: Multimedia :: Graphics
12
+ Requires-Dist: numpy
13
+ Requires-Dist: pillow
14
+ Requires-Dist: piexif>=1.1.1,<2.0.0
15
+ Requires-Dist: pytest ; extra == "dev"
16
+ Project-URL: Changelog, https://github.com/yellowdolphin/autolevels/blob/master/CHANGELOG.md
17
+ Project-URL: Homepage, https://github.com/yellowdolphin/autolevels
18
+ Project-URL: Issues, https://github.com/yellowdolphin/autolevels/issues
19
+ Provides-Extra: dev
20
+
21
+ # AutoLevels
22
+
23
+ AutoLevels is a program for batch-processing images to fix common issues in a semi- or fully-automated fashion.
24
+
25
+ ## Purpose
26
+
27
+ When you encounter images scanned from analog film or poorly processed by automatic corrections, such as "backlight" or simply underexposed, you will find black/white points that are too high/low. Even worse, they can differ by channel and produce a weird glow in dark areas or color cast on the entire image. A typical quick solution is offered by "autolevel" or contrast enhancing features, which set black and white points to zero and 255, respectively. This again might overshoot the problem, and the result may appear unnatural, particularly if the original image has low contrast.
28
+
29
+ AutoLevels helps you fix these issues by letting you choose sensible black/white points for a batch of images. It detects low-contrast images and treats them differently. Along the way, you can remove a constant color cast, change gamma and saturation. If your color cast or bad camera settings require a more complex curve correction, AutoLevels has you covered: try the AI-based free curve correction, which finds the optimal RGB curves for each image.
30
+
31
+ ## Features
32
+
33
+ - Adjust black point, white point, gamma, and saturation
34
+ - Smooth/Histogram/Perceptive black/white point sampling
35
+ - Automatically detect low-contrast images and apply sensible corrections
36
+ - Fully automated curve correction
37
+ - Flexible definition of input/output files (glob pattern, prefix/suffix, Python f-string)
38
+ - Preserves JPEG properties (quality, EXIF)
39
+ - Open source, free software (GPLv3)
40
+
41
+ ## Installation
42
+
43
+ If you have Python 3.9 or later installed on a Linux or MacOS machine, open a shell and execute:
44
+
45
+ ```bash
46
+ pip install autolevels
47
+ ```
48
+
49
+ This will install the current stable release. To get the latest version from the github repository (requires git), use
50
+
51
+ ```bash
52
+ pip install git+https://github.com/yellowdolphin/autolevels.git
53
+ ```
54
+
55
+ This will also install the following requirements if not found:
56
+ - numpy
57
+ - pillow
58
+ - piexif
59
+
60
+ If you want to use the fully automated curve correction feature, two additional steps are needed:
61
+ 1. Install [PyTorch](https://pytorch.org/).
62
+ 2. Download a [Free Curve Inference model](https://www.kaggle.com/models/greendolphin/freecin) as tar.gz and extract it:
63
+ ```bash
64
+ tar -xzvf freecin-pytorch-xcittiny-v1.tar.gz
65
+ ```
66
+
67
+ Now, you should be good to go:
68
+ ```bash
69
+ autolevels --model {your_downloaded_model_file} -- example.jpg
70
+ ```
71
+
72
+ ## Documentation
73
+
74
+ ### Basic Usage
75
+
76
+ ```bash
77
+ autolevels --blackpoint 10 --whitepoint 255 --gamma 1.1 -- example.jpg
78
+ ```
79
+
80
+ This will process the file `example.jpg` and write the output to `example_al.jpg` using the default suffix "`_al`". You can change that with `--outsuffix <my suffix>` or specify an output folder with `--outdir`. See **Batch Processing** for more ways to define input and output file names.
81
+
82
+ Get a description of all options with:
83
+
84
+ ```bash
85
+ autolevels -h
86
+ ```
87
+
88
+ Safely try out settings before writing any output files with `--simulate` or `--sandbox`. You can check file names, black/white point correction, as images are read and processed, but not saved.
89
+ ```bash
90
+ autolevels --simulate --blackpoint 10 5 0 --mode perceptive -- *.jpg
91
+ ```
92
+
93
+ ### Batch Processing
94
+
95
+ The power of batch processing lets you apply the same corrections to a batch of images with a common capture source, camera settings, lighting conditions, or any common issue that can be fixed in a semi-automated fashion. If you don't have the time or expertise to find the optimal parameters, you can leverage AI power using the `--model` option. This will correct each image with an individual RGB curve, fully automatic, correcting color casts, bad exposure, or white balance settings on the fly.
96
+
97
+ This leaves you with defining input and output files and paths. AutoLevels gives you three ways to do that.
98
+
99
+ 1. **Folders and glob patterns**
100
+ ```bash
101
+ autolevels --outdir processed -- scans/*.png IMG_00[0-3]?.jpg
102
+ ```
103
+ Your shell will interpret these glob patterns and expand the file names to `scans/12.png scans/23.png IMG_0015.jpg ...` matching any existing files in the current directory. All output files are written to the specified folder `processed`.
104
+
105
+ If you are afraid the expanded list of file paths exceeds the shell limit for the length of a command, you can specify a folder for the input files and enter the glob pattern in quotes to escape shell expansion:
106
+ ```bash
107
+ autolevels --folder ~/Pictures/scans -- "*.tif"
108
+ ```
109
+
110
+ 2. **Prefixes and Suffixes**
111
+ Often, your input file names will have a common folder, prefix, suffix, and some variable part in between. You may want to keep the variable part and change any of the fixed components, for example:
112
+ ```bash
113
+ autolevels --folder orig --prefix scn --suffix .jpg --outfolder processed --outprefix img_ --outsuffix .jpg -- 1 2 3 4
114
+ ```
115
+ This will search for input files `orig/scn1.jpg ...` and write output files `processed/img_1.jpg ...`
116
+
117
+ 3. **Python f-strings**
118
+ An alternative way to define file names in AutoLevels is to use Python f-strings. Don't worry, no Python skills required, just look at this example:
119
+ ```python
120
+ variable = 42
121
+ f"orig/scn_{variable:04d}.jpg"
122
+ ```
123
+ This is proper Python code and evaluates to "orig/scn_0042.jpg". The part in curly brackets contains a variable name and (after the `:`) an optional format instruction for integer numbers `d`, which shall have leading `0`s to make `4` digits.
124
+
125
+ If you provide an f-string to the `--fstring` or `--outfstring` options (you can skip the "f" before the quotes), AutoLevels substitutes `variable` by any values given instead of file names:
126
+ ```bash
127
+ autolevels --fstring "orig/scn{i}.jpg" --outfstring "processed/img_{i:04d}.jpg" -- 1 2 3
128
+ ```
129
+ This will read files `orig/scn1.jpg ...` and write `processed/img_0001.jpg ...` to disk.
130
+
@@ -0,0 +1,109 @@
1
+ # AutoLevels
2
+
3
+ AutoLevels is a program for batch-processing images to fix common issues in a semi- or fully-automated fashion.
4
+
5
+ ## Purpose
6
+
7
+ When you encounter images scanned from analog film or poorly processed by automatic corrections, such as "backlight" or simply underexposed, you will find black/white points that are too high/low. Even worse, they can differ by channel and produce a weird glow in dark areas or color cast on the entire image. A typical quick solution is offered by "autolevel" or contrast enhancing features, which set black and white points to zero and 255, respectively. This again might overshoot the problem, and the result may appear unnatural, particularly if the original image has low contrast.
8
+
9
+ AutoLevels helps you fix these issues by letting you choose sensible black/white points for a batch of images. It detects low-contrast images and treats them differently. Along the way, you can remove a constant color cast, change gamma and saturation. If your color cast or bad camera settings require a more complex curve correction, AutoLevels has you covered: try the AI-based free curve correction, which finds the optimal RGB curves for each image.
10
+
11
+ ## Features
12
+
13
+ - Adjust black point, white point, gamma, and saturation
14
+ - Smooth/Histogram/Perceptive black/white point sampling
15
+ - Automatically detect low-contrast images and apply sensible corrections
16
+ - Fully automated curve correction
17
+ - Flexible definition of input/output files (glob pattern, prefix/suffix, Python f-string)
18
+ - Preserves JPEG properties (quality, EXIF)
19
+ - Open source, free software (GPLv3)
20
+
21
+ ## Installation
22
+
23
+ If you have Python 3.9 or later installed on a Linux or MacOS machine, open a shell and execute:
24
+
25
+ ```bash
26
+ pip install autolevels
27
+ ```
28
+
29
+ This will install the current stable release. To get the latest version from the github repository (requires git), use
30
+
31
+ ```bash
32
+ pip install git+https://github.com/yellowdolphin/autolevels.git
33
+ ```
34
+
35
+ This will also install the following requirements if not found:
36
+ - numpy
37
+ - pillow
38
+ - piexif
39
+
40
+ If you want to use the fully automated curve correction feature, two additional steps are needed:
41
+ 1. Install [PyTorch](https://pytorch.org/).
42
+ 2. Download a [Free Curve Inference model](https://www.kaggle.com/models/greendolphin/freecin) as tar.gz and extract it:
43
+ ```bash
44
+ tar -xzvf freecin-pytorch-xcittiny-v1.tar.gz
45
+ ```
46
+
47
+ Now, you should be good to go:
48
+ ```bash
49
+ autolevels --model {your_downloaded_model_file} -- example.jpg
50
+ ```
51
+
52
+ ## Documentation
53
+
54
+ ### Basic Usage
55
+
56
+ ```bash
57
+ autolevels --blackpoint 10 --whitepoint 255 --gamma 1.1 -- example.jpg
58
+ ```
59
+
60
+ This will process the file `example.jpg` and write the output to `example_al.jpg` using the default suffix "`_al`". You can change that with `--outsuffix <my suffix>` or specify an output folder with `--outdir`. See **Batch Processing** for more ways to define input and output file names.
61
+
62
+ Get a description of all options with:
63
+
64
+ ```bash
65
+ autolevels -h
66
+ ```
67
+
68
+ Safely try out settings before writing any output files with `--simulate` or `--sandbox`. You can check file names, black/white point correction, as images are read and processed, but not saved.
69
+ ```bash
70
+ autolevels --simulate --blackpoint 10 5 0 --mode perceptive -- *.jpg
71
+ ```
72
+
73
+ ### Batch Processing
74
+
75
+ The power of batch processing lets you apply the same corrections to a batch of images with a common capture source, camera settings, lighting conditions, or any common issue that can be fixed in a semi-automated fashion. If you don't have the time or expertise to find the optimal parameters, you can leverage AI power using the `--model` option. This will correct each image with an individual RGB curve, fully automatic, correcting color casts, bad exposure, or white balance settings on the fly.
76
+
77
+ This leaves you with defining input and output files and paths. AutoLevels gives you three ways to do that.
78
+
79
+ 1. **Folders and glob patterns**
80
+ ```bash
81
+ autolevels --outdir processed -- scans/*.png IMG_00[0-3]?.jpg
82
+ ```
83
+ Your shell will interpret these glob patterns and expand the file names to `scans/12.png scans/23.png IMG_0015.jpg ...` matching any existing files in the current directory. All output files are written to the specified folder `processed`.
84
+
85
+ If you are afraid the expanded list of file paths exceeds the shell limit for the length of a command, you can specify a folder for the input files and enter the glob pattern in quotes to escape shell expansion:
86
+ ```bash
87
+ autolevels --folder ~/Pictures/scans -- "*.tif"
88
+ ```
89
+
90
+ 2. **Prefixes and Suffixes**
91
+ Often, your input file names will have a common folder, prefix, suffix, and some variable part in between. You may want to keep the variable part and change any of the fixed components, for example:
92
+ ```bash
93
+ autolevels --folder orig --prefix scn --suffix .jpg --outfolder processed --outprefix img_ --outsuffix .jpg -- 1 2 3 4
94
+ ```
95
+ This will search for input files `orig/scn1.jpg ...` and write output files `processed/img_1.jpg ...`
96
+
97
+ 3. **Python f-strings**
98
+ An alternative way to define file names in AutoLevels is to use Python f-strings. Don't worry, no Python skills required, just look at this example:
99
+ ```python
100
+ variable = 42
101
+ f"orig/scn_{variable:04d}.jpg"
102
+ ```
103
+ This is proper Python code and evaluates to "orig/scn_0042.jpg". The part in curly brackets contains a variable name and (after the `:`) an optional format instruction for integer numbers `d`, which shall have leading `0`s to make `4` digits.
104
+
105
+ If you provide an f-string to the `--fstring` or `--outfstring` options (you can skip the "f" before the quotes), AutoLevels substitutes `variable` by any values given instead of file names:
106
+ ```bash
107
+ autolevels --fstring "orig/scn{i}.jpg" --outfstring "processed/img_{i:04d}.jpg" -- 1 2 3
108
+ ```
109
+ This will read files `orig/scn1.jpg ...` and write `processed/img_0001.jpg ...` to disk.
@@ -0,0 +1,3 @@
1
+ from .autolevels import main, __version__, evaluate_fstring
2
+
3
+ __all__ = ['main', '__version__', 'evaluate_fstring']