fotolab 0.34.0__tar.gz → 0.34.1__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.
Files changed (41) hide show
  1. {fotolab-0.34.0/src/fotolab.egg-info → fotolab-0.34.1}/PKG-INFO +29 -22
  2. {fotolab-0.34.0 → fotolab-0.34.1}/README.md +28 -21
  3. {fotolab-0.34.0 → fotolab-0.34.1}/pyproject.toml +1 -1
  4. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab/subcommands/animate.py +3 -3
  5. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab/subcommands/auto.py +3 -3
  6. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab/subcommands/border.py +3 -3
  7. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab/subcommands/contrast.py +5 -5
  8. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab/subcommands/halftone.py +19 -16
  9. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab/subcommands/montage.py +5 -5
  10. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab/subcommands/resize.py +3 -3
  11. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab/subcommands/rotate.py +4 -4
  12. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab/subcommands/sharpen.py +6 -6
  13. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab/subcommands/watermark.py +8 -8
  14. {fotolab-0.34.0 → fotolab-0.34.1/src/fotolab.egg-info}/PKG-INFO +29 -22
  15. {fotolab-0.34.0 → fotolab-0.34.1}/LICENSE.md +0 -0
  16. {fotolab-0.34.0 → fotolab-0.34.1}/setup.cfg +0 -0
  17. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab/__init__.py +0 -0
  18. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab/__main__.py +0 -0
  19. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab/cli.py +0 -0
  20. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab/subcommands/__init__.py +0 -0
  21. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab/subcommands/env.py +0 -0
  22. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab/subcommands/info.py +0 -0
  23. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab.egg-info/SOURCES.txt +0 -0
  24. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab.egg-info/dependency_links.txt +0 -0
  25. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab.egg-info/entry_points.txt +0 -0
  26. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab.egg-info/requires.txt +0 -0
  27. {fotolab-0.34.0 → fotolab-0.34.1}/src/fotolab.egg-info/top_level.txt +0 -0
  28. {fotolab-0.34.0 → fotolab-0.34.1}/tests/test_animate_subcommand.py +0 -0
  29. {fotolab-0.34.0 → fotolab-0.34.1}/tests/test_auto_subcommand.py +0 -0
  30. {fotolab-0.34.0 → fotolab-0.34.1}/tests/test_border_subcommand.py +0 -0
  31. {fotolab-0.34.0 → fotolab-0.34.1}/tests/test_contrast_subcommand.py +0 -0
  32. {fotolab-0.34.0 → fotolab-0.34.1}/tests/test_env_subcommand.py +0 -0
  33. {fotolab-0.34.0 → fotolab-0.34.1}/tests/test_halftone_subcommand.py +0 -0
  34. {fotolab-0.34.0 → fotolab-0.34.1}/tests/test_help_flag.py +0 -0
  35. {fotolab-0.34.0 → fotolab-0.34.1}/tests/test_info_subcommand.py +0 -0
  36. {fotolab-0.34.0 → fotolab-0.34.1}/tests/test_montage_subcommand.py +0 -0
  37. {fotolab-0.34.0 → fotolab-0.34.1}/tests/test_quiet_flag.py +0 -0
  38. {fotolab-0.34.0 → fotolab-0.34.1}/tests/test_resize_subcommand.py +0 -0
  39. {fotolab-0.34.0 → fotolab-0.34.1}/tests/test_rotate_subcommand.py +0 -0
  40. {fotolab-0.34.0 → fotolab-0.34.1}/tests/test_sharpen_subcommand.py +0 -0
  41. {fotolab-0.34.0 → fotolab-0.34.1}/tests/test_watermark_subcommand.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fotolab
3
- Version: 0.34.0
3
+ Version: 0.34.1
4
4
  Summary: A console program to manipulate photos.
5
5
  Author-email: Kian-Meng Ang <kianmeng@cpan.org>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -112,10 +112,11 @@ fotolab animate -h
112
112
  usage: fotolab animate [-h] [-f FORMAT] [-d DURATION] [-l LOOP] [-op]
113
113
  [--webp-quality QUALITY] [--webp-lossless]
114
114
  [--webp-method METHOD] [-od OUTPUT_DIR]
115
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
115
+ [-of OUTPUT_FILENAME]
116
+ IMAGE_PATHS [IMAGE_PATHS ...]
116
117
 
117
118
  positional arguments:
118
- IMAGE_FILENAMES set the image filenames
119
+ IMAGE_PATHS set the image filenames
119
120
 
120
121
  options:
121
122
  -h, --help show this help message and exit
@@ -133,6 +134,8 @@ options:
133
134
  default: '4')
134
135
  -od, --output-dir OUTPUT_DIR
135
136
  set default output folder (default: 'output')
137
+ -of, --output-filename OUTPUT_FILENAME
138
+ set output filename (default: 'None')
136
139
  ```
137
140
 
138
141
  <!--help-animate !-->
@@ -146,13 +149,17 @@ fotolab auto -h
146
149
  <!--help-auto !-->
147
150
 
148
151
  ```console
149
- usage: fotolab auto [-h] IMAGE_FILENAMES [IMAGE_FILENAMES ...]
152
+ usage: fotolab auto [-h] [-t TITLE] [-w WATERMARK_TEXT]
153
+ IMAGE_PATHS [IMAGE_PATHS ...]
150
154
 
151
155
  positional arguments:
152
- IMAGE_FILENAMES set the image filename
156
+ IMAGE_PATHS set the image filename
153
157
 
154
158
  options:
155
- -h, --help show this help message and exit
159
+ -h, --help show this help message and exit
160
+ -t, --title TITLE set the tile (default: 'None')
161
+ -w, --watermark WATERMARK_TEXT
162
+ set the watermark (default: 'kianmeng.org')
156
163
  ```
157
164
 
158
165
  <!--help-auto !-->
@@ -168,10 +175,10 @@ fotolab border -h
168
175
  ```console
169
176
  usage: fotolab border [-h] [-c COLOR] [-w WIDTH] [-wt WIDTH] [-wr WIDTH]
170
177
  [-wb WIDTH] [-wl WIDTH] [-op] [-od OUTPUT_DIR]
171
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
178
+ IMAGE_PATHS [IMAGE_PATHS ...]
172
179
 
173
180
  positional arguments:
174
- IMAGE_FILENAMES set the image filenames
181
+ IMAGE_PATHS set the image filenames
175
182
 
176
183
  options:
177
184
  -h, --help show this help message and exit
@@ -204,10 +211,10 @@ fotolab contrast -h
204
211
 
205
212
  ```console
206
213
  usage: fotolab contrast [-h] [-c CUTOFF] [-op] [-od OUTPUT_DIR]
207
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
214
+ IMAGE_PATHS [IMAGE_PATHS ...]
208
215
 
209
216
  positional arguments:
210
- IMAGE_FILENAMES set the image filename
217
+ IMAGE_PATHS set the image filename
211
218
 
212
219
  options:
213
220
  -h, --help show this help message and exit
@@ -231,10 +238,10 @@ fotolab halftone -h
231
238
 
232
239
  ```console
233
240
  usage: fotolab halftone [-h] [-ba] [-op] [-od OUTPUT_DIR] [-c CELLS] [-g]
234
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
241
+ IMAGE_PATHS [IMAGE_PATHS ...]
235
242
 
236
243
  positional arguments:
237
- IMAGE_FILENAMES set the image filename
244
+ IMAGE_PATHS set the image filename
238
245
 
239
246
  options:
240
247
  -h, --help show this help message and exit
@@ -283,10 +290,10 @@ fotolab rotate -h
283
290
 
284
291
  ```console
285
292
  usage: fotolab rotate [-h] [-r ROTATION] [-cw] [-op] [-od OUTPUT_DIR]
286
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
293
+ IMAGE_PATHS [IMAGE_PATHS ...]
287
294
 
288
295
  positional arguments:
289
- IMAGE_FILENAMES set the image filenames
296
+ IMAGE_PATHS set the image filenames
290
297
 
291
298
  options:
292
299
  -h, --help show this help message and exit
@@ -311,10 +318,10 @@ fotolab montage -h
311
318
 
312
319
  ```console
313
320
  usage: fotolab montage [-h] [-op] [-od OUTPUT_DIR]
314
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
321
+ IMAGE_PATHS [IMAGE_PATHS ...]
315
322
 
316
323
  positional arguments:
317
- IMAGE_FILENAMES set the image filenames
324
+ IMAGE_PATHS set the image filenames
318
325
 
319
326
  options:
320
327
  -h, --help show this help message and exit
@@ -337,10 +344,10 @@ fotolab resize -h
337
344
  ```console
338
345
  usage: fotolab resize [-h] [-c] [-l CANVAS_COLOR] [-W WIDTH | -H HEIGHT] [-op]
339
346
  [-od OUTPUT_DIR]
340
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
347
+ IMAGE_PATHS [IMAGE_PATHS ...]
341
348
 
342
349
  positional arguments:
343
- IMAGE_FILENAMES set the image filename
350
+ IMAGE_PATHS set the image filename
344
351
 
345
352
  options:
346
353
  -h, --help show this help message and exit
@@ -369,10 +376,10 @@ fotolab sharpen -h
369
376
  ```console
370
377
  usage: fotolab sharpen [-h] [-r RADIUS] [-p PERCENT] [-t THRESHOLD] [-ba]
371
378
  [-op] [-od OUTPUT_DIR]
372
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
379
+ IMAGE_PATHS [IMAGE_PATHS ...]
373
380
 
374
381
  positional arguments:
375
- IMAGE_FILENAMES set the image filenames
382
+ IMAGE_PATHS set the image filenames
376
383
 
377
384
  options:
378
385
  -h, --help show this help message and exit
@@ -408,10 +415,10 @@ usage: fotolab watermark [-h] [-t WATERMARK_TEXT]
408
415
  [-a ALPHA_VALUE] [--camera]
409
416
  [-l | --lowercase | --no-lowercase] [-op]
410
417
  [-od OUTPUT_DIR]
411
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
418
+ IMAGE_PATHS [IMAGE_PATHS ...]
412
419
 
413
420
  positional arguments:
414
- IMAGE_FILENAMES set the image filenames
421
+ IMAGE_PATHS set the image filenames
415
422
 
416
423
  options:
417
424
  -h, --help show this help message and exit
@@ -73,10 +73,11 @@ fotolab animate -h
73
73
  usage: fotolab animate [-h] [-f FORMAT] [-d DURATION] [-l LOOP] [-op]
74
74
  [--webp-quality QUALITY] [--webp-lossless]
75
75
  [--webp-method METHOD] [-od OUTPUT_DIR]
76
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
76
+ [-of OUTPUT_FILENAME]
77
+ IMAGE_PATHS [IMAGE_PATHS ...]
77
78
 
78
79
  positional arguments:
79
- IMAGE_FILENAMES set the image filenames
80
+ IMAGE_PATHS set the image filenames
80
81
 
81
82
  options:
82
83
  -h, --help show this help message and exit
@@ -94,6 +95,8 @@ options:
94
95
  default: '4')
95
96
  -od, --output-dir OUTPUT_DIR
96
97
  set default output folder (default: 'output')
98
+ -of, --output-filename OUTPUT_FILENAME
99
+ set output filename (default: 'None')
97
100
  ```
98
101
 
99
102
  <!--help-animate !-->
@@ -107,13 +110,17 @@ fotolab auto -h
107
110
  <!--help-auto !-->
108
111
 
109
112
  ```console
110
- usage: fotolab auto [-h] IMAGE_FILENAMES [IMAGE_FILENAMES ...]
113
+ usage: fotolab auto [-h] [-t TITLE] [-w WATERMARK_TEXT]
114
+ IMAGE_PATHS [IMAGE_PATHS ...]
111
115
 
112
116
  positional arguments:
113
- IMAGE_FILENAMES set the image filename
117
+ IMAGE_PATHS set the image filename
114
118
 
115
119
  options:
116
- -h, --help show this help message and exit
120
+ -h, --help show this help message and exit
121
+ -t, --title TITLE set the tile (default: 'None')
122
+ -w, --watermark WATERMARK_TEXT
123
+ set the watermark (default: 'kianmeng.org')
117
124
  ```
118
125
 
119
126
  <!--help-auto !-->
@@ -129,10 +136,10 @@ fotolab border -h
129
136
  ```console
130
137
  usage: fotolab border [-h] [-c COLOR] [-w WIDTH] [-wt WIDTH] [-wr WIDTH]
131
138
  [-wb WIDTH] [-wl WIDTH] [-op] [-od OUTPUT_DIR]
132
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
139
+ IMAGE_PATHS [IMAGE_PATHS ...]
133
140
 
134
141
  positional arguments:
135
- IMAGE_FILENAMES set the image filenames
142
+ IMAGE_PATHS set the image filenames
136
143
 
137
144
  options:
138
145
  -h, --help show this help message and exit
@@ -165,10 +172,10 @@ fotolab contrast -h
165
172
 
166
173
  ```console
167
174
  usage: fotolab contrast [-h] [-c CUTOFF] [-op] [-od OUTPUT_DIR]
168
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
175
+ IMAGE_PATHS [IMAGE_PATHS ...]
169
176
 
170
177
  positional arguments:
171
- IMAGE_FILENAMES set the image filename
178
+ IMAGE_PATHS set the image filename
172
179
 
173
180
  options:
174
181
  -h, --help show this help message and exit
@@ -192,10 +199,10 @@ fotolab halftone -h
192
199
 
193
200
  ```console
194
201
  usage: fotolab halftone [-h] [-ba] [-op] [-od OUTPUT_DIR] [-c CELLS] [-g]
195
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
202
+ IMAGE_PATHS [IMAGE_PATHS ...]
196
203
 
197
204
  positional arguments:
198
- IMAGE_FILENAMES set the image filename
205
+ IMAGE_PATHS set the image filename
199
206
 
200
207
  options:
201
208
  -h, --help show this help message and exit
@@ -244,10 +251,10 @@ fotolab rotate -h
244
251
 
245
252
  ```console
246
253
  usage: fotolab rotate [-h] [-r ROTATION] [-cw] [-op] [-od OUTPUT_DIR]
247
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
254
+ IMAGE_PATHS [IMAGE_PATHS ...]
248
255
 
249
256
  positional arguments:
250
- IMAGE_FILENAMES set the image filenames
257
+ IMAGE_PATHS set the image filenames
251
258
 
252
259
  options:
253
260
  -h, --help show this help message and exit
@@ -272,10 +279,10 @@ fotolab montage -h
272
279
 
273
280
  ```console
274
281
  usage: fotolab montage [-h] [-op] [-od OUTPUT_DIR]
275
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
282
+ IMAGE_PATHS [IMAGE_PATHS ...]
276
283
 
277
284
  positional arguments:
278
- IMAGE_FILENAMES set the image filenames
285
+ IMAGE_PATHS set the image filenames
279
286
 
280
287
  options:
281
288
  -h, --help show this help message and exit
@@ -298,10 +305,10 @@ fotolab resize -h
298
305
  ```console
299
306
  usage: fotolab resize [-h] [-c] [-l CANVAS_COLOR] [-W WIDTH | -H HEIGHT] [-op]
300
307
  [-od OUTPUT_DIR]
301
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
308
+ IMAGE_PATHS [IMAGE_PATHS ...]
302
309
 
303
310
  positional arguments:
304
- IMAGE_FILENAMES set the image filename
311
+ IMAGE_PATHS set the image filename
305
312
 
306
313
  options:
307
314
  -h, --help show this help message and exit
@@ -330,10 +337,10 @@ fotolab sharpen -h
330
337
  ```console
331
338
  usage: fotolab sharpen [-h] [-r RADIUS] [-p PERCENT] [-t THRESHOLD] [-ba]
332
339
  [-op] [-od OUTPUT_DIR]
333
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
340
+ IMAGE_PATHS [IMAGE_PATHS ...]
334
341
 
335
342
  positional arguments:
336
- IMAGE_FILENAMES set the image filenames
343
+ IMAGE_PATHS set the image filenames
337
344
 
338
345
  options:
339
346
  -h, --help show this help message and exit
@@ -369,10 +376,10 @@ usage: fotolab watermark [-h] [-t WATERMARK_TEXT]
369
376
  [-a ALPHA_VALUE] [--camera]
370
377
  [-l | --lowercase | --no-lowercase] [-op]
371
378
  [-od OUTPUT_DIR]
372
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
379
+ IMAGE_PATHS [IMAGE_PATHS ...]
373
380
 
374
381
  positional arguments:
375
- IMAGE_FILENAMES set the image filenames
382
+ IMAGE_PATHS set the image filenames
376
383
 
377
384
  options:
378
385
  -h, --help show this help message and exit
@@ -7,7 +7,7 @@ where = ["src"]
7
7
 
8
8
  [project]
9
9
  name = "fotolab"
10
- version = "0.34.0"
10
+ version = "0.34.1"
11
11
  description = "A console program to manipulate photos."
12
12
  authors = [{name = "Kian-Meng Ang", email = "kianmeng@cpan.org"}]
13
13
  requires-python = ">=3.10"
@@ -49,12 +49,12 @@ def build_subparser(subparsers) -> None:
49
49
  animate_parser.set_defaults(func=run)
50
50
 
51
51
  animate_parser.add_argument(
52
- dest="image_filenames",
52
+ dest="image_paths",
53
53
  help="set the image filenames",
54
54
  nargs="+",
55
55
  type=str,
56
56
  default=None,
57
- metavar="IMAGE_FILENAMES",
57
+ metavar="IMAGE_PATHS",
58
58
  )
59
59
 
60
60
  animate_parser.add_argument(
@@ -159,7 +159,7 @@ def run(args: argparse.Namespace) -> None:
159
159
  """
160
160
  log.debug(args)
161
161
 
162
- image_filepaths = [Path(f) for f in args.image_filenames]
162
+ image_filepaths = [Path(f) for f in args.image_paths]
163
163
  first_image_filepath = image_filepaths[0]
164
164
  other_frames = []
165
165
 
@@ -36,12 +36,12 @@ def build_subparser(subparsers) -> None:
36
36
  auto_parser.set_defaults(func=run)
37
37
 
38
38
  auto_parser.add_argument(
39
- dest="image_filenames",
39
+ dest="image_paths",
40
40
  help="set the image filename",
41
41
  nargs="+",
42
42
  type=str,
43
43
  default=None,
44
- metavar="IMAGE_FILENAMES",
44
+ metavar="IMAGE_PATHS",
45
45
  )
46
46
 
47
47
  auto_parser.add_argument(
@@ -114,7 +114,7 @@ def run(args: argparse.Namespace) -> None:
114
114
  fotolab.subcommands.sharpen.run(combined_args)
115
115
  fotolab.subcommands.watermark.run(combined_args)
116
116
 
117
- if len(args.image_filenames) > 1:
117
+ if len(args.image_paths) > 1:
118
118
  output_filename = (
119
119
  args.title.lower().replace(",", "").replace(" ", "_") + ".gif"
120
120
  )
@@ -34,12 +34,12 @@ def build_subparser(subparsers: argparse._SubParsersAction) -> None:
34
34
  border_parser.set_defaults(func=run)
35
35
 
36
36
  border_parser.add_argument(
37
- dest="image_filenames",
37
+ dest="image_paths",
38
38
  help="set the image filenames",
39
39
  nargs="+",
40
40
  type=str,
41
41
  default=None,
42
- metavar="IMAGE_FILENAMES",
42
+ metavar="IMAGE_PATHS",
43
43
  )
44
44
 
45
45
  border_parser.add_argument(
@@ -135,7 +135,7 @@ def run(args: argparse.Namespace) -> None:
135
135
  """
136
136
  log.debug(args)
137
137
 
138
- for image_filepath in [Path(f) for f in args.image_filenames]:
138
+ for image_filepath in [Path(f) for f in args.image_paths]:
139
139
  original_image = Image.open(image_filepath)
140
140
  border = get_border(args)
141
141
  bordered_image = ImageOps.expand(
@@ -51,12 +51,12 @@ def build_subparser(subparsers: argparse._SubParsersAction) -> None:
51
51
  contrast_parser.set_defaults(func=run)
52
52
 
53
53
  contrast_parser.add_argument(
54
- dest="image_filenames",
54
+ dest="image_paths",
55
55
  help="set the image filename",
56
56
  nargs="+",
57
57
  type=str,
58
58
  default=None,
59
- metavar="IMAGE_FILENAMES",
59
+ metavar="IMAGE_PATHS",
60
60
  )
61
61
 
62
62
  contrast_parser.add_argument(
@@ -102,8 +102,8 @@ def run(args: argparse.Namespace) -> None:
102
102
  """
103
103
  log.debug(args)
104
104
 
105
- for image_filename in args.image_filenames:
106
- original_image = Image.open(image_filename)
105
+ for image_path_str in args.image_paths:
106
+ original_image = Image.open(image_path_str)
107
107
 
108
108
  if original_image.mode == "RGBA":
109
109
  # Split the image into RGB and Alpha channels
@@ -124,4 +124,4 @@ def run(args: argparse.Namespace) -> None:
124
124
  original_image, cutoff=args.cutoff
125
125
  )
126
126
 
127
- save_image(args, contrast_image, Path(image_filename), "contrast")
127
+ save_image(args, contrast_image, Path(image_path_str), "contrast")
@@ -45,12 +45,12 @@ def build_subparser(subparsers) -> None:
45
45
  halftone_parser.set_defaults(func=run)
46
46
 
47
47
  halftone_parser.add_argument(
48
- dest="image_filenames",
48
+ dest="image_paths",
49
49
  help="set the image filename",
50
50
  nargs="+",
51
51
  type=str,
52
52
  default=None,
53
- metavar="IMAGE_FILENAMES",
53
+ metavar="IMAGE_PATHS",
54
54
  )
55
55
 
56
56
  halftone_parser.add_argument(
@@ -111,8 +111,8 @@ def run(args: argparse.Namespace) -> None:
111
111
  """
112
112
  log.debug(args)
113
113
 
114
- for image_filename_str in args.image_filenames:
115
- image_filename = Path(image_filename_str)
114
+ for image_path_str in args.image_paths:
115
+ image_filename = Path(image_path_str)
116
116
  original_image = Image.open(image_filename)
117
117
  halftone_image = create_halftone_image(
118
118
  original_image, args.cells, args.grayscale
@@ -133,6 +133,7 @@ def run(args: argparse.Namespace) -> None:
133
133
  def _draw_halftone_dot(
134
134
  draw: ImageDraw.ImageDraw,
135
135
  source_image: Image.Image,
136
+ brightness_map: Image.Image,
136
137
  cell: HalftoneCell,
137
138
  grayscale: bool,
138
139
  fill_color_dot: int,
@@ -150,21 +151,19 @@ def _draw_halftone_dot(
150
151
  x = max(0, x)
151
152
  y = max(0, y)
152
153
 
153
- # get pixel value (brightness or color) from the source image using clamped
154
- # coordinates
154
+ # Get brightness from the pre-calculated map (L mode)
155
+ brightness = brightness_map.getpixel((x, y))
156
+
157
+ # Get pixel value (color) from the source image
155
158
  pixel_value = source_image.getpixel((x, y))
156
159
 
157
160
  if grayscale:
158
- brightness = pixel_value
159
- dot_fill = fill_color_dot # Use white for grayscale dots
161
+ # In grayscale mode, source_image is L mode, pixel_value is brightness
162
+ # dot_fill is the fixed color (255 for white dot on black background)
163
+ dot_fill = fill_color_dot
160
164
  else:
161
- # calculate brightness (luminance) from the RGB color
162
- brightness = int(
163
- 0.299 * pixel_value[0]
164
- + 0.587 * pixel_value[1]
165
- + 0.114 * pixel_value[2]
166
- )
167
- dot_fill = pixel_value # Use original color for color dots
165
+ # In color mode, dot_fill is the original color
166
+ dot_fill = pixel_value
168
167
 
169
168
  # calculate dot radius relative to cell size based on brightness max radius
170
169
  # is half the cell size
@@ -203,8 +202,11 @@ def create_halftone_image(
203
202
  fill_color_black: int | tuple[int, int, int]
204
203
  fill_color_dot_for_grayscale: int
205
204
 
205
+ # Always create a grayscale version for brightness calculation (dot size)
206
+ brightness_map = original_image.convert("L")
207
+
206
208
  if grayscale:
207
- source_image = original_image.convert("L")
209
+ source_image = brightness_map
208
210
  output_mode = "L"
209
211
  fill_color_black = 0
210
212
  fill_color_dot_for_grayscale = 255
@@ -229,6 +231,7 @@ def create_halftone_image(
229
231
  _draw_halftone_dot(
230
232
  draw,
231
233
  source_image,
234
+ brightness_map,
232
235
  cell,
233
236
  grayscale,
234
237
  fill_color_dot_for_grayscale,
@@ -35,12 +35,12 @@ def build_subparser(subparsers) -> None:
35
35
  montage_parser.set_defaults(func=run)
36
36
 
37
37
  montage_parser.add_argument(
38
- dest="image_filenames",
38
+ dest="image_paths",
39
39
  help="set the image filenames",
40
40
  nargs="+",
41
41
  type=str,
42
42
  default=None,
43
- metavar="IMAGE_FILENAMES",
43
+ metavar="IMAGE_PATHS",
44
44
  )
45
45
 
46
46
  montage_parser.add_argument(
@@ -72,8 +72,8 @@ def run(args: argparse.Namespace) -> None:
72
72
  """
73
73
  log.debug(args)
74
74
  images = []
75
- for image_filename_str in args.image_filenames:
76
- image_filename = Path(image_filename_str)
75
+ for image_path_str in args.image_paths:
76
+ image_filename = Path(image_path_str)
77
77
  images.append(Image.open(image_filename))
78
78
 
79
79
  if len(images) < 2:
@@ -89,5 +89,5 @@ def run(args: argparse.Namespace) -> None:
89
89
  montaged_image.paste(image, (x_offset, 0))
90
90
  x_offset += image.width
91
91
 
92
- output_image_filename = Path(args.image_filenames[0])
92
+ output_image_filename = Path(args.image_paths[0])
93
93
  save_image(args, montaged_image, output_image_filename, "montage")
@@ -38,12 +38,12 @@ def build_subparser(subparsers) -> None:
38
38
  resize_parser.set_defaults(func=run)
39
39
 
40
40
  resize_parser.add_argument(
41
- dest="image_filenames",
41
+ dest="image_paths",
42
42
  help="set the image filename",
43
43
  nargs="+",
44
44
  type=str,
45
45
  default=None,
46
- metavar="IMAGE_FILENAMES",
46
+ metavar="IMAGE_PATHS",
47
47
  )
48
48
 
49
49
  resize_parser.add_argument(
@@ -137,7 +137,7 @@ def run(args: argparse.Namespace) -> None:
137
137
  """
138
138
  log.debug(args)
139
139
 
140
- for image_filepath in [Path(f) for f in args.image_filenames]:
140
+ for image_filepath in [Path(f) for f in args.image_paths]:
141
141
  original_image = Image.open(image_filepath)
142
142
  if args.canvas:
143
143
  resized_image = _resize_image_onto_canvas(original_image, args)
@@ -33,12 +33,12 @@ def build_subparser(subparsers) -> None:
33
33
  rotate_parser.set_defaults(func=run)
34
34
 
35
35
  rotate_parser.add_argument(
36
- dest="image_filenames",
36
+ dest="image_paths",
37
37
  help="set the image filenames",
38
38
  nargs="+",
39
39
  type=str,
40
40
  default=None,
41
- metavar="IMAGE_FILENAMES",
41
+ metavar="IMAGE_PATHS",
42
42
  )
43
43
 
44
44
  rotate_parser.add_argument(
@@ -88,8 +88,8 @@ def run(args: argparse.Namespace) -> None:
88
88
  rotation = -args.rotation if args.clockwise else args.rotation
89
89
  log.debug(f"Rotation angle: {rotation} degrees")
90
90
 
91
- for image_filename_str in args.image_filenames:
92
- image_filename = Path(image_filename_str)
91
+ for image_path_str in args.image_paths:
92
+ image_filename = Path(image_path_str)
93
93
  log.debug(f"Processing image: {image_filename}")
94
94
  original_image = Image.open(image_filename)
95
95
  log.debug(f"Original image size: {original_image.size}")
@@ -33,12 +33,12 @@ def build_subparser(subparsers) -> None:
33
33
  sharpen_parser.set_defaults(func=run)
34
34
 
35
35
  sharpen_parser.add_argument(
36
- dest="image_filenames",
36
+ dest="image_paths",
37
37
  help="set the image filenames",
38
38
  nargs="+",
39
39
  type=str,
40
40
  default=None,
41
- metavar="IMAGE_FILENAMES",
41
+ metavar="IMAGE_PATHS",
42
42
  )
43
43
 
44
44
  sharpen_parser.add_argument(
@@ -115,8 +115,8 @@ def run(args: argparse.Namespace) -> None:
115
115
  """
116
116
  log.debug(args)
117
117
 
118
- for image_filename in args.image_filenames:
119
- original_image = Image.open(image_filename)
118
+ for image_path_str in args.image_paths:
119
+ original_image = Image.open(image_path_str)
120
120
  sharpen_image = original_image.filter(
121
121
  ImageFilter.UnsharpMask(
122
122
  args.radius, percent=args.percent, threshold=args.threshold
@@ -125,10 +125,10 @@ def run(args: argparse.Namespace) -> None:
125
125
  if args.before_after:
126
126
  save_gif_image(
127
127
  args,
128
- Path(image_filename),
128
+ Path(image_path_str),
129
129
  original_image,
130
130
  sharpen_image,
131
131
  "sharpen",
132
132
  )
133
133
  else:
134
- save_image(args, sharpen_image, Path(image_filename), "sharpen")
134
+ save_image(args, sharpen_image, Path(image_path_str), "sharpen")
@@ -43,12 +43,12 @@ def build_subparser(subparsers: argparse._SubParsersAction) -> None:
43
43
  watermark_parser.set_defaults(func=run)
44
44
 
45
45
  watermark_parser.add_argument(
46
- dest="image_filenames",
46
+ dest="image_paths",
47
47
  help="set the image filenames",
48
48
  nargs="+",
49
49
  type=str,
50
50
  default=None,
51
- metavar="IMAGE_FILENAMES",
51
+ metavar="IMAGE_PATHS",
52
52
  )
53
53
 
54
54
  watermark_parser.add_argument(
@@ -190,24 +190,24 @@ def run(args: argparse.Namespace) -> None:
190
190
  """
191
191
  log.debug(args)
192
192
 
193
- for image_filename in args.image_filenames:
193
+ for image_path_str in args.image_paths:
194
194
  try:
195
- image: Image.Image = Image.open(image_filename)
195
+ image: Image.Image = Image.open(image_path_str)
196
196
  except FileNotFoundError:
197
- log.error("Image file not found: %s", image_filename)
197
+ log.error("Image file not found: %s", image_path_str)
198
198
  continue
199
199
  except Exception as e:
200
- log.error("Could not open image %s: %s", image_filename, e)
200
+ log.error("Could not open image %s: %s", image_path_str, e)
201
201
  continue
202
202
 
203
203
  if image.format == "GIF":
204
- watermark_gif_image(image, image_filename, args)
204
+ watermark_gif_image(image, image_path_str, args)
205
205
  else:
206
206
  watermarked_image: Image.Image = watermark_non_gif_image(
207
207
  image, args
208
208
  )
209
209
  save_image(
210
- args, watermarked_image, Path(image_filename), "watermark"
210
+ args, watermarked_image, Path(image_path_str), "watermark"
211
211
  )
212
212
 
213
213
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fotolab
3
- Version: 0.34.0
3
+ Version: 0.34.1
4
4
  Summary: A console program to manipulate photos.
5
5
  Author-email: Kian-Meng Ang <kianmeng@cpan.org>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -112,10 +112,11 @@ fotolab animate -h
112
112
  usage: fotolab animate [-h] [-f FORMAT] [-d DURATION] [-l LOOP] [-op]
113
113
  [--webp-quality QUALITY] [--webp-lossless]
114
114
  [--webp-method METHOD] [-od OUTPUT_DIR]
115
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
115
+ [-of OUTPUT_FILENAME]
116
+ IMAGE_PATHS [IMAGE_PATHS ...]
116
117
 
117
118
  positional arguments:
118
- IMAGE_FILENAMES set the image filenames
119
+ IMAGE_PATHS set the image filenames
119
120
 
120
121
  options:
121
122
  -h, --help show this help message and exit
@@ -133,6 +134,8 @@ options:
133
134
  default: '4')
134
135
  -od, --output-dir OUTPUT_DIR
135
136
  set default output folder (default: 'output')
137
+ -of, --output-filename OUTPUT_FILENAME
138
+ set output filename (default: 'None')
136
139
  ```
137
140
 
138
141
  <!--help-animate !-->
@@ -146,13 +149,17 @@ fotolab auto -h
146
149
  <!--help-auto !-->
147
150
 
148
151
  ```console
149
- usage: fotolab auto [-h] IMAGE_FILENAMES [IMAGE_FILENAMES ...]
152
+ usage: fotolab auto [-h] [-t TITLE] [-w WATERMARK_TEXT]
153
+ IMAGE_PATHS [IMAGE_PATHS ...]
150
154
 
151
155
  positional arguments:
152
- IMAGE_FILENAMES set the image filename
156
+ IMAGE_PATHS set the image filename
153
157
 
154
158
  options:
155
- -h, --help show this help message and exit
159
+ -h, --help show this help message and exit
160
+ -t, --title TITLE set the tile (default: 'None')
161
+ -w, --watermark WATERMARK_TEXT
162
+ set the watermark (default: 'kianmeng.org')
156
163
  ```
157
164
 
158
165
  <!--help-auto !-->
@@ -168,10 +175,10 @@ fotolab border -h
168
175
  ```console
169
176
  usage: fotolab border [-h] [-c COLOR] [-w WIDTH] [-wt WIDTH] [-wr WIDTH]
170
177
  [-wb WIDTH] [-wl WIDTH] [-op] [-od OUTPUT_DIR]
171
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
178
+ IMAGE_PATHS [IMAGE_PATHS ...]
172
179
 
173
180
  positional arguments:
174
- IMAGE_FILENAMES set the image filenames
181
+ IMAGE_PATHS set the image filenames
175
182
 
176
183
  options:
177
184
  -h, --help show this help message and exit
@@ -204,10 +211,10 @@ fotolab contrast -h
204
211
 
205
212
  ```console
206
213
  usage: fotolab contrast [-h] [-c CUTOFF] [-op] [-od OUTPUT_DIR]
207
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
214
+ IMAGE_PATHS [IMAGE_PATHS ...]
208
215
 
209
216
  positional arguments:
210
- IMAGE_FILENAMES set the image filename
217
+ IMAGE_PATHS set the image filename
211
218
 
212
219
  options:
213
220
  -h, --help show this help message and exit
@@ -231,10 +238,10 @@ fotolab halftone -h
231
238
 
232
239
  ```console
233
240
  usage: fotolab halftone [-h] [-ba] [-op] [-od OUTPUT_DIR] [-c CELLS] [-g]
234
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
241
+ IMAGE_PATHS [IMAGE_PATHS ...]
235
242
 
236
243
  positional arguments:
237
- IMAGE_FILENAMES set the image filename
244
+ IMAGE_PATHS set the image filename
238
245
 
239
246
  options:
240
247
  -h, --help show this help message and exit
@@ -283,10 +290,10 @@ fotolab rotate -h
283
290
 
284
291
  ```console
285
292
  usage: fotolab rotate [-h] [-r ROTATION] [-cw] [-op] [-od OUTPUT_DIR]
286
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
293
+ IMAGE_PATHS [IMAGE_PATHS ...]
287
294
 
288
295
  positional arguments:
289
- IMAGE_FILENAMES set the image filenames
296
+ IMAGE_PATHS set the image filenames
290
297
 
291
298
  options:
292
299
  -h, --help show this help message and exit
@@ -311,10 +318,10 @@ fotolab montage -h
311
318
 
312
319
  ```console
313
320
  usage: fotolab montage [-h] [-op] [-od OUTPUT_DIR]
314
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
321
+ IMAGE_PATHS [IMAGE_PATHS ...]
315
322
 
316
323
  positional arguments:
317
- IMAGE_FILENAMES set the image filenames
324
+ IMAGE_PATHS set the image filenames
318
325
 
319
326
  options:
320
327
  -h, --help show this help message and exit
@@ -337,10 +344,10 @@ fotolab resize -h
337
344
  ```console
338
345
  usage: fotolab resize [-h] [-c] [-l CANVAS_COLOR] [-W WIDTH | -H HEIGHT] [-op]
339
346
  [-od OUTPUT_DIR]
340
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
347
+ IMAGE_PATHS [IMAGE_PATHS ...]
341
348
 
342
349
  positional arguments:
343
- IMAGE_FILENAMES set the image filename
350
+ IMAGE_PATHS set the image filename
344
351
 
345
352
  options:
346
353
  -h, --help show this help message and exit
@@ -369,10 +376,10 @@ fotolab sharpen -h
369
376
  ```console
370
377
  usage: fotolab sharpen [-h] [-r RADIUS] [-p PERCENT] [-t THRESHOLD] [-ba]
371
378
  [-op] [-od OUTPUT_DIR]
372
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
379
+ IMAGE_PATHS [IMAGE_PATHS ...]
373
380
 
374
381
  positional arguments:
375
- IMAGE_FILENAMES set the image filenames
382
+ IMAGE_PATHS set the image filenames
376
383
 
377
384
  options:
378
385
  -h, --help show this help message and exit
@@ -408,10 +415,10 @@ usage: fotolab watermark [-h] [-t WATERMARK_TEXT]
408
415
  [-a ALPHA_VALUE] [--camera]
409
416
  [-l | --lowercase | --no-lowercase] [-op]
410
417
  [-od OUTPUT_DIR]
411
- IMAGE_FILENAMES [IMAGE_FILENAMES ...]
418
+ IMAGE_PATHS [IMAGE_PATHS ...]
412
419
 
413
420
  positional arguments:
414
- IMAGE_FILENAMES set the image filenames
421
+ IMAGE_PATHS set the image filenames
415
422
 
416
423
  options:
417
424
  -h, --help show this help message and exit
File without changes
File without changes
File without changes