fotolab 0.28.0__py3-none-any.whl → 0.28.1__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 +14 -12
- fotolab/subcommands/contrast.py +11 -6
- {fotolab-0.28.0.dist-info → fotolab-0.28.1.dist-info}/METADATA +1 -1
- {fotolab-0.28.0.dist-info → fotolab-0.28.1.dist-info}/RECORD +7 -7
- {fotolab-0.28.0.dist-info → fotolab-0.28.1.dist-info}/LICENSE.md +0 -0
- {fotolab-0.28.0.dist-info → fotolab-0.28.1.dist-info}/WHEEL +0 -0
- {fotolab-0.28.0.dist-info → fotolab-0.28.1.dist-info}/entry_points.txt +0 -0
fotolab/__init__.py
CHANGED
@@ -23,7 +23,7 @@ from pathlib import Path
|
|
23
23
|
|
24
24
|
from PIL import Image
|
25
25
|
|
26
|
-
__version__ = "0.28.
|
26
|
+
__version__ = "0.28.1"
|
27
27
|
|
28
28
|
log = logging.getLogger(__name__)
|
29
29
|
|
@@ -43,7 +43,7 @@ def save_gif_image(
|
|
43
43
|
)
|
44
44
|
new_filename.parent.mkdir(parents=True, exist_ok=True)
|
45
45
|
|
46
|
-
log.info("
|
46
|
+
log.info("%s gif image: %s", subcommand, new_filename)
|
47
47
|
original_image.save(
|
48
48
|
new_filename,
|
49
49
|
format="gif",
|
@@ -79,7 +79,9 @@ def save_image(args, new_image, output_filename, subcommand):
|
|
79
79
|
_open_image(new_filename)
|
80
80
|
|
81
81
|
|
82
|
-
def _get_output_filename(
|
82
|
+
def _get_output_filename(
|
83
|
+
args: argparse.Namespace, image_file: Path, subcommand: str
|
84
|
+
) -> Path:
|
83
85
|
"""Build and return output filename based on the command line options."""
|
84
86
|
if args.overwrite:
|
85
87
|
return image_file.with_name(image_file.name)
|
@@ -91,14 +93,14 @@ def _get_output_filename(args, image_file, subcommand):
|
|
91
93
|
|
92
94
|
def _open_image(filename):
|
93
95
|
"""Open generated image using default program."""
|
94
|
-
platform_open_func = {
|
95
|
-
"linux": subprocess.call(["xdg-open", filename]),
|
96
|
-
"darwin": subprocess.call(["open", filename]),
|
97
|
-
"windows": subprocess.call(["start", filename]),
|
98
|
-
}
|
99
96
|
try:
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
97
|
+
if sys.platform == "linux":
|
98
|
+
subprocess.call(["xdg-open", filename])
|
99
|
+
elif sys.platform == "darwin":
|
100
|
+
subprocess.call(["open", filename])
|
101
|
+
elif sys.platform == "windows":
|
102
|
+
subprocess.Popen(["open", filename])
|
104
103
|
log.info("open image: %s", filename.resolve())
|
104
|
+
|
105
|
+
except OSError as e:
|
106
|
+
log.error("Error opening image: %s -> %s", filename, e)
|
fotolab/subcommands/contrast.py
CHANGED
@@ -86,9 +86,14 @@ def run(args: argparse.Namespace) -> None:
|
|
86
86
|
log.debug(args)
|
87
87
|
|
88
88
|
for image_filename in args.image_filenames:
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
89
|
+
try:
|
90
|
+
original_image = Image.open(image_filename)
|
91
|
+
contrast_image = ImageOps.autocontrast(
|
92
|
+
original_image, cutoff=args.cutoff
|
93
|
+
)
|
94
|
+
|
95
|
+
save_image(args, contrast_image, image_filename, "contrast")
|
96
|
+
except FileNotFoundError:
|
97
|
+
log.error(f"Image file not found: {image_filename}")
|
98
|
+
except IOError:
|
99
|
+
log.error(f"Cannot open or read image file: {image_filename}")
|
@@ -1,11 +1,11 @@
|
|
1
|
-
fotolab/__init__.py,sha256=
|
1
|
+
fotolab/__init__.py,sha256=2IDAKI99oReVMX9sl3GdQS_kEOdZBAa-rBuCKItjCYE,3239
|
2
2
|
fotolab/__main__.py,sha256=aboOURPs_snOXTEWYR0q8oq1UTY9e-NxCd1j33V0wHI,833
|
3
3
|
fotolab/cli.py,sha256=fIApD9C4Vkn-u4CejOFTboSV5f-Ks9vBGxeb-_ca-Nw,3935
|
4
4
|
fotolab/subcommands/__init__.py,sha256=l3DlIaJ3u3jGjnC1H1yV8LZ_nPqOLJ6gikD4BCaMAQ0,1129
|
5
5
|
fotolab/subcommands/animate.py,sha256=OcS6Q6JM1TW6HF0dSgBsV9mpEGwDMcJlQssupkf0_ZA,3393
|
6
6
|
fotolab/subcommands/auto.py,sha256=ia-xegV1Z4HvYsbKgmTzf1NfNFdTDPWfZe7vQ1_90Ik,2425
|
7
7
|
fotolab/subcommands/border.py,sha256=zTRVnaifFcE8k_xEMhonbaiZaU_b1bDF2nBy8Hk0VXs,4360
|
8
|
-
fotolab/subcommands/contrast.py,sha256=
|
8
|
+
fotolab/subcommands/contrast.py,sha256=fkY_Xd405eifObGoqR4AsLSNriNBpkFjDR_pZ1AMqcc,2754
|
9
9
|
fotolab/subcommands/env.py,sha256=QoxRvzZKgmoHTUxDV4QYhdChCpMWs5TbXFY_qIpIQpE,1469
|
10
10
|
fotolab/subcommands/halftone.py,sha256=bRGG_Bg1T5ZV3UWsdMszOdPmc6g9_R0yNp5mb0g8hcE,4152
|
11
11
|
fotolab/subcommands/info.py,sha256=Qp-Zu7Xp1ptLK211hOkFM5oxZWGTrlNBqCpbx2IjL9Y,3371
|
@@ -14,8 +14,8 @@ fotolab/subcommands/resize.py,sha256=UOb2rg_5ArRj0gxPTDOww_ix3tqJRC0W5b_S-Lt1G4w
|
|
14
14
|
fotolab/subcommands/rotate.py,sha256=uBFjHyjiBSQLtrtH1p9myODIHUDr1gkL4PpU-6Y1Ofo,2575
|
15
15
|
fotolab/subcommands/sharpen.py,sha256=YNho2IPbc-lPvSy3Bsjehc2JOEy27LPqFSGRULs9MyY,3492
|
16
16
|
fotolab/subcommands/watermark.py,sha256=A_dUy_yf9wPHUexB9aIicFIS-BpWrjjfI8Hr4WCCBoc,9449
|
17
|
-
fotolab-0.28.
|
18
|
-
fotolab-0.28.
|
19
|
-
fotolab-0.28.
|
20
|
-
fotolab-0.28.
|
21
|
-
fotolab-0.28.
|
17
|
+
fotolab-0.28.1.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
|
18
|
+
fotolab-0.28.1.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
19
|
+
fotolab-0.28.1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
20
|
+
fotolab-0.28.1.dist-info/METADATA,sha256=1gHE2Gk-XVzrNRzPhVQZew5Qr3oDY6gMNtj2hlPqpGE,12896
|
21
|
+
fotolab-0.28.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|