fotolab 0.9.0__py2.py3-none-any.whl → 0.9.1__py2.py3-none-any.whl
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.
- fotolab/__init__.py +31 -1
- fotolab/auto.py +1 -0
- fotolab/border.py +3 -13
- fotolab/contrast.py +3 -14
- fotolab/env.py +3 -1
- fotolab/resize.py +4 -14
- fotolab/sharpen.py +3 -14
- fotolab/watermark.py +3 -14
- {fotolab-0.9.0.dist-info → fotolab-0.9.1.dist-info}/METADATA +1 -1
- fotolab-0.9.1.dist-info/RECORD +15 -0
- fotolab-0.9.0.dist-info/RECORD +0 -15
- {fotolab-0.9.0.dist-info → fotolab-0.9.1.dist-info}/LICENSE.md +0 -0
- {fotolab-0.9.0.dist-info → fotolab-0.9.1.dist-info}/WHEEL +0 -0
- {fotolab-0.9.0.dist-info → fotolab-0.9.1.dist-info}/entry_points.txt +0 -0
fotolab/__init__.py
CHANGED
@@ -19,12 +19,42 @@ import logging
|
|
19
19
|
import os
|
20
20
|
import subprocess
|
21
21
|
import sys
|
22
|
+
from pathlib import Path
|
22
23
|
|
23
|
-
__version__ = "0.9.
|
24
|
+
__version__ = "0.9.1"
|
24
25
|
|
25
26
|
log = logging.getLogger(__name__)
|
26
27
|
|
27
28
|
|
29
|
+
def save_image(args, new_image):
|
30
|
+
"""Run resize subcommand.
|
31
|
+
|
32
|
+
Args:
|
33
|
+
args (argparse.Namespace): Config from command line arguments
|
34
|
+
new_image(PIL.Image.Image): Modified image
|
35
|
+
|
36
|
+
Returns:
|
37
|
+
None
|
38
|
+
"""
|
39
|
+
action = args.func.__module__.split(".")[-1]
|
40
|
+
image_file = Path(args.image_filename)
|
41
|
+
|
42
|
+
if args.overwrite:
|
43
|
+
new_filename = image_file.with_name(image_file.name)
|
44
|
+
else:
|
45
|
+
new_filename = Path(
|
46
|
+
args.output_dir,
|
47
|
+
image_file.with_name(f"{action}_{image_file.name}"),
|
48
|
+
)
|
49
|
+
new_filename.parent.mkdir(parents=True, exist_ok=True)
|
50
|
+
|
51
|
+
log.info("%s image: %s", action, new_filename)
|
52
|
+
new_image.save(new_filename)
|
53
|
+
|
54
|
+
if args.open:
|
55
|
+
_open_image(new_filename)
|
56
|
+
|
57
|
+
|
28
58
|
def _open_image(filename):
|
29
59
|
"""Open generated image using default program."""
|
30
60
|
if sys.platform == "linux":
|
fotolab/auto.py
CHANGED
fotolab/border.py
CHANGED
@@ -17,10 +17,11 @@
|
|
17
17
|
|
18
18
|
import argparse
|
19
19
|
import logging
|
20
|
-
from pathlib import Path
|
21
20
|
|
22
21
|
from PIL import Image, ImageColor, ImageOps
|
23
22
|
|
23
|
+
from fotolab import save_image
|
24
|
+
|
24
25
|
log = logging.getLogger(__name__)
|
25
26
|
|
26
27
|
|
@@ -110,8 +111,6 @@ def run(args: argparse.Namespace) -> None:
|
|
110
111
|
"""
|
111
112
|
log.debug(args)
|
112
113
|
|
113
|
-
image_file = Path(args.image_filename)
|
114
|
-
|
115
114
|
original_image = Image.open(args.image_filename)
|
116
115
|
|
117
116
|
if (
|
@@ -135,13 +134,4 @@ def run(args: argparse.Namespace) -> None:
|
|
135
134
|
fill=ImageColor.getrgb(args.color),
|
136
135
|
)
|
137
136
|
|
138
|
-
|
139
|
-
new_filename = image_file.with_name(image_file.name)
|
140
|
-
else:
|
141
|
-
new_filename = Path(
|
142
|
-
args.output_dir, image_file.with_name(f"border_{image_file.name}")
|
143
|
-
)
|
144
|
-
new_filename.parent.mkdir(parents=True, exist_ok=True)
|
145
|
-
|
146
|
-
log.info("creating image: %s", new_filename)
|
147
|
-
bordered_image.save(new_filename)
|
137
|
+
save_image(args, bordered_image)
|
fotolab/contrast.py
CHANGED
@@ -17,10 +17,11 @@
|
|
17
17
|
|
18
18
|
import argparse
|
19
19
|
import logging
|
20
|
-
from pathlib import Path
|
21
20
|
|
22
21
|
from PIL import Image, ImageOps
|
23
22
|
|
23
|
+
from fotolab import save_image
|
24
|
+
|
24
25
|
log = logging.getLogger(__name__)
|
25
26
|
|
26
27
|
|
@@ -66,19 +67,7 @@ def run(args: argparse.Namespace) -> None:
|
|
66
67
|
"""
|
67
68
|
log.debug(args)
|
68
69
|
|
69
|
-
image_file = Path(args.image_filename)
|
70
|
-
|
71
70
|
original_image = Image.open(args.image_filename)
|
72
71
|
contrast_image = ImageOps.autocontrast(original_image, cutoff=args.cutoff)
|
73
72
|
|
74
|
-
|
75
|
-
new_filename = image_file.with_name(image_file.name)
|
76
|
-
else:
|
77
|
-
new_filename = Path(
|
78
|
-
args.output_dir,
|
79
|
-
image_file.with_name(f"contrast_{image_file.name}"),
|
80
|
-
)
|
81
|
-
new_filename.parent.mkdir(parents=True, exist_ok=True)
|
82
|
-
|
83
|
-
log.info("contrasting image: %s", new_filename)
|
84
|
-
contrast_image.save(new_filename)
|
73
|
+
save_image(args, contrast_image)
|
fotolab/env.py
CHANGED
@@ -45,6 +45,8 @@ def run(args: argparse.Namespace) -> None:
|
|
45
45
|
"""
|
46
46
|
log.debug(args)
|
47
47
|
|
48
|
+
sys_version = sys.version.replace("\n", "")
|
49
|
+
|
48
50
|
print(f"fotolab: {__version__}")
|
49
|
-
print(f"python: {
|
51
|
+
print(f"python: {sys_version}")
|
50
52
|
print(f"platform: {platform.platform()}")
|
fotolab/resize.py
CHANGED
@@ -17,10 +17,11 @@
|
|
17
17
|
|
18
18
|
import argparse
|
19
19
|
import logging
|
20
|
-
from pathlib import Path
|
21
20
|
|
22
21
|
from PIL import Image
|
23
22
|
|
23
|
+
from fotolab import save_image
|
24
|
+
|
24
25
|
log = logging.getLogger(__name__)
|
25
26
|
|
26
27
|
|
@@ -63,28 +64,17 @@ def run(args: argparse.Namespace) -> None:
|
|
63
64
|
"""Run resize subcommand.
|
64
65
|
|
65
66
|
Args:
|
66
|
-
|
67
|
+
args (argparse.Namespace): Config from command line arguments
|
67
68
|
|
68
69
|
Returns:
|
69
70
|
None
|
70
71
|
"""
|
71
72
|
log.debug(args)
|
72
73
|
|
73
|
-
image_file = Path(args.image_filename)
|
74
74
|
original_image = Image.open(args.image_filename)
|
75
75
|
resized_image = original_image.copy()
|
76
76
|
resized_image = resized_image.resize(
|
77
77
|
(args.width, args.height), Image.Resampling.LANCZOS
|
78
78
|
)
|
79
79
|
|
80
|
-
|
81
|
-
new_filename = image_file.with_name(image_file.name)
|
82
|
-
else:
|
83
|
-
new_filename = Path(
|
84
|
-
args.output_dir,
|
85
|
-
image_file.with_name(f"resize_{image_file.name}"),
|
86
|
-
)
|
87
|
-
new_filename.parent.mkdir(parents=True, exist_ok=True)
|
88
|
-
|
89
|
-
log.info("resizing image: %s", new_filename)
|
90
|
-
resized_image.save(new_filename)
|
80
|
+
save_image(args, resized_image)
|
fotolab/sharpen.py
CHANGED
@@ -17,10 +17,11 @@
|
|
17
17
|
|
18
18
|
import argparse
|
19
19
|
import logging
|
20
|
-
from pathlib import Path
|
21
20
|
|
22
21
|
from PIL import Image, ImageFilter
|
23
22
|
|
23
|
+
from fotolab import save_image
|
24
|
+
|
24
25
|
log = logging.getLogger(__name__)
|
25
26
|
|
26
27
|
|
@@ -86,22 +87,10 @@ def run(args: argparse.Namespace) -> None:
|
|
86
87
|
"""
|
87
88
|
log.debug(args)
|
88
89
|
|
89
|
-
image_file = Path(args.image_filename)
|
90
|
-
|
91
90
|
original_image = Image.open(args.image_filename)
|
92
91
|
sharpen_image = original_image.filter(
|
93
92
|
ImageFilter.UnsharpMask(
|
94
93
|
args.radius, percent=args.percent, threshold=args.threshold
|
95
94
|
)
|
96
95
|
)
|
97
|
-
|
98
|
-
if args.overwrite:
|
99
|
-
new_filename = image_file.with_name(image_file.name)
|
100
|
-
else:
|
101
|
-
new_filename = Path(
|
102
|
-
args.output_dir, image_file.with_name(f"sharpen_{image_file.name}")
|
103
|
-
)
|
104
|
-
new_filename.parent.mkdir(parents=True, exist_ok=True)
|
105
|
-
|
106
|
-
log.info("sharpening image: %s", new_filename)
|
107
|
-
sharpen_image.save(new_filename)
|
96
|
+
save_image(args, sharpen_image)
|
fotolab/watermark.py
CHANGED
@@ -17,10 +17,11 @@
|
|
17
17
|
|
18
18
|
import argparse
|
19
19
|
import logging
|
20
|
-
from pathlib import Path
|
21
20
|
|
22
21
|
from PIL import Image, ImageColor, ImageDraw, ImageFont
|
23
22
|
|
23
|
+
from fotolab import save_image
|
24
|
+
|
24
25
|
log = logging.getLogger(__name__)
|
25
26
|
|
26
27
|
POSITIONS = ["top-left", "top-right", "bottom-left", "bottom-right"]
|
@@ -119,8 +120,6 @@ def run(args: argparse.Namespace) -> None:
|
|
119
120
|
"""
|
120
121
|
log.debug(args)
|
121
122
|
|
122
|
-
image_file = Path(args.image_filename)
|
123
|
-
|
124
123
|
original_image = Image.open(args.image_filename)
|
125
124
|
watermarked_image = original_image.copy()
|
126
125
|
|
@@ -146,17 +145,7 @@ def run(args: argparse.Namespace) -> None:
|
|
146
145
|
stroke_fill=ImageColor.getrgb(args.outline_color),
|
147
146
|
)
|
148
147
|
|
149
|
-
|
150
|
-
new_filename = image_file.with_name(image_file.name)
|
151
|
-
else:
|
152
|
-
new_filename = Path(
|
153
|
-
args.output_dir,
|
154
|
-
image_file.with_name(f"watermark_{image_file.name}"),
|
155
|
-
)
|
156
|
-
new_filename.parent.mkdir(parents=True, exist_ok=True)
|
157
|
-
|
158
|
-
log.info("watermarking image: %s", new_filename)
|
159
|
-
watermarked_image.save(new_filename)
|
148
|
+
save_image(args, watermarked_image)
|
160
149
|
|
161
150
|
|
162
151
|
def calculate_position(image, text_width, text_height, position) -> tuple:
|
@@ -0,0 +1,15 @@
|
|
1
|
+
fotolab/__init__.py,sha256=3N1D57pcYWYmpOUqPIomNqEWg4qVTyVQP6AUvKRNGOg,2015
|
2
|
+
fotolab/__main__.py,sha256=aboOURPs_snOXTEWYR0q8oq1UTY9e-NxCd1j33V0wHI,833
|
3
|
+
fotolab/auto.py,sha256=k4DkHQp05m7UYUgHRrH9L1d0eSgOzrn2Cyk5BG27KyA,2173
|
4
|
+
fotolab/border.py,sha256=-XNa118OpiXwCXptSCl1HdxTJ2SSnv62HSg6xfBChaY,3413
|
5
|
+
fotolab/cli.py,sha256=4IEk0DRrCPIG0PB37f4zSyWUEbrZrLSKi5qJxb1M0Is,4433
|
6
|
+
fotolab/contrast.py,sha256=chIjzw2h7TA_u63Y_ZNS_0otxtyXgHmHaCDOMUayS_A,1969
|
7
|
+
fotolab/env.py,sha256=NTTvfISWBBfIw5opWrUfg0BtkaAtdUtcISBAJC2gVUk,1449
|
8
|
+
fotolab/resize.py,sha256=6314jLmhwb_ktd6uKEToaNHW0ZOyPW2IiELosBsIcXs,2128
|
9
|
+
fotolab/sharpen.py,sha256=5lLWZ2JOM-jfsqr6Lt9tlijZH1oz4KlvBytTL0-QLQI,2535
|
10
|
+
fotolab/watermark.py,sha256=Hn3nUhQo3iFhvtlsLjGjFMGG8rqKFNGOYQBcwRS250M,4648
|
11
|
+
fotolab-0.9.1.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
|
12
|
+
fotolab-0.9.1.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
13
|
+
fotolab-0.9.1.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
14
|
+
fotolab-0.9.1.dist-info/METADATA,sha256=ukyF71SeL7LHXiYzH90aXgo6xzA94Q3aQ_iZjZDRr7s,6688
|
15
|
+
fotolab-0.9.1.dist-info/RECORD,,
|
fotolab-0.9.0.dist-info/RECORD
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
fotolab/__init__.py,sha256=a0NCJBRDthqiPJOuVD1dvsVwDXvm-ruruL26QiEL6q8,1237
|
2
|
-
fotolab/__main__.py,sha256=aboOURPs_snOXTEWYR0q8oq1UTY9e-NxCd1j33V0wHI,833
|
3
|
-
fotolab/auto.py,sha256=q_d_lOZh410nvh9yGNS3k-jg5mB0zQrhOfxSmi-nShA,2142
|
4
|
-
fotolab/border.py,sha256=QBA-rJ0phv_3ace20NW18PlhLIbYDjdGVJwX13vDKdI,3776
|
5
|
-
fotolab/cli.py,sha256=4IEk0DRrCPIG0PB37f4zSyWUEbrZrLSKi5qJxb1M0Is,4433
|
6
|
-
fotolab/contrast.py,sha256=dtQ39YBDmBhFlRS0jB8XqLsoNGEz96ZYfgg71MyeLFg,2350
|
7
|
-
fotolab/env.py,sha256=XUwy3TAFFcTMvtXAT0tLJbo-ianBo_FPK2IQfvBOhic,1400
|
8
|
-
fotolab/resize.py,sha256=ax4IacQR4vuGGxGI3B-ito6ldiT054QkaKympiv4y20,2505
|
9
|
-
fotolab/sharpen.py,sha256=PP1xYXupOetQxQxXijzWiUlrKNlu80lfInG37VQhVYw,2902
|
10
|
-
fotolab/watermark.py,sha256=X7u-HlOONfOhU8VRyvOgIvXYUu_q9IKHBMEkIf-oem4,5031
|
11
|
-
fotolab-0.9.0.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
|
12
|
-
fotolab-0.9.0.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
13
|
-
fotolab-0.9.0.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
14
|
-
fotolab-0.9.0.dist-info/METADATA,sha256=i_R7skWGswlLGC1_GbZWdXWkXTup2iGeQ17iaHRZ8vc,6688
|
15
|
-
fotolab-0.9.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|