fotolab 0.15.0__py2.py3-none-any.whl → 0.16.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 CHANGED
@@ -21,7 +21,7 @@ import subprocess
21
21
  import sys
22
22
  from pathlib import Path
23
23
 
24
- __version__ = "0.15.0"
24
+ __version__ = "0.16.1"
25
25
 
26
26
  log = logging.getLogger(__name__)
27
27
 
fotolab/cli.py CHANGED
@@ -33,6 +33,7 @@ import fotolab.env
33
33
  import fotolab.info
34
34
  import fotolab.montage
35
35
  import fotolab.resize
36
+ import fotolab.rotate
36
37
  import fotolab.sharpen
37
38
  import fotolab.watermark
38
39
  from fotolab import __version__
@@ -140,6 +141,7 @@ def build_parser() -> argparse.ArgumentParser:
140
141
  fotolab.contrast.build_subparser(subparsers)
141
142
  fotolab.info.build_subparser(subparsers)
142
143
  fotolab.resize.build_subparser(subparsers)
144
+ fotolab.rotate.build_subparser(subparsers)
143
145
  fotolab.montage.build_subparser(subparsers)
144
146
  fotolab.sharpen.build_subparser(subparsers)
145
147
  fotolab.watermark.build_subparser(subparsers)
fotolab/rotate.py ADDED
@@ -0,0 +1,61 @@
1
+ # Copyright (C) 2024 Kian-Meng Ang
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify it under
4
+ # the terms of the GNU Affero General Public License as published by the Free
5
+ # Software Foundation, either version 3 of the License, or (at your option) any
6
+ # later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful, but WITHOUT
9
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10
+ # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
11
+ # details.
12
+ #
13
+ # You should have received a copy of the GNU Affero General Public License
14
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+ """Rotate subcommand."""
17
+
18
+ import argparse
19
+ import logging
20
+
21
+ from PIL import Image
22
+
23
+ from fotolab import save_image
24
+
25
+ log = logging.getLogger(__name__)
26
+
27
+
28
+ def build_subparser(subparsers) -> None:
29
+ """Build the subparser."""
30
+ rotate_parser = subparsers.add_parser("rotate", help="rotate an image")
31
+
32
+ rotate_parser.set_defaults(func=run)
33
+
34
+ rotate_parser.add_argument(
35
+ dest="image_filenames",
36
+ help="set the image filenames",
37
+ nargs="+",
38
+ type=str,
39
+ default=None,
40
+ metavar="IMAGE_FILENAMES",
41
+ )
42
+
43
+
44
+ def run(args: argparse.Namespace) -> None:
45
+ """Run rotate subcommand.
46
+
47
+ Args:
48
+ config (argparse.Namespace): Config from command line arguments
49
+
50
+ Returns:
51
+ None
52
+ """
53
+ log.debug(args)
54
+
55
+ for image_filename in args.image_filenames:
56
+ original_image = Image.open(image_filename)
57
+ rotated_image = original_image.rotate(
58
+ 180,
59
+ expand=True,
60
+ )
61
+ save_image(args, rotated_image, image_filename, "rotate")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fotolab
3
- Version: 0.15.0
3
+ Version: 0.16.1
4
4
  Summary: A console program that manipulate images.
5
5
  Keywords: photography,photo
6
6
  Author-email: Kian-Meng Ang <kianmeng@cpan.org>
@@ -58,7 +58,7 @@ fotolab -h
58
58
 
59
59
  ```console
60
60
  usage: fotolab [-h] [-o] [-op] [-od OUTPUT_DIR] [-q] [-v] [-d] [-V]
61
- {animate,auto,border,contrast,info,resize,montage,sharpen,watermark,env}
61
+ {animate,auto,border,contrast,info,resize,rotate,montage,sharpen,watermark,env}
62
62
  ...
63
63
 
64
64
  A console program to manipulate photos.
@@ -68,7 +68,7 @@ A console program to manipulate photos.
68
68
  issues: https://github.com/kianmeng/fotolab/issues
69
69
 
70
70
  positional arguments:
71
- {animate,auto,border,contrast,info,resize,montage,sharpen,watermark,env}
71
+ {animate,auto,border,contrast,info,resize,rotate,montage,sharpen,watermark,env}
72
72
  sub-command help
73
73
  animate animate an image
74
74
  auto auto adjust (resize, contrast, and watermark) a photo
@@ -76,6 +76,7 @@ positional arguments:
76
76
  contrast contrast an image
77
77
  info info an image
78
78
  resize resize an image
79
+ rotate rotate an image
79
80
  montage montage a list of image
80
81
  sharpen sharpen an image
81
82
  watermark watermark an image
@@ -196,6 +197,22 @@ optional arguments:
196
197
  -h, --help show this help message and exit
197
198
  ```
198
199
 
200
+ ### fotolab rotate
201
+
202
+ ```console
203
+ fotolab rotate -h
204
+ ```
205
+
206
+ ```console
207
+ usage: fotolab rotate [-h] IMAGE_FILENAMES [IMAGE_FILENAMES ...]
208
+
209
+ positional arguments:
210
+ IMAGE_FILENAMES set the image filenames
211
+
212
+ optional arguments:
213
+ -h, --help show this help message and exit
214
+ ```
215
+
199
216
  ### fotolab montage
200
217
 
201
218
  ```console
@@ -1,18 +1,19 @@
1
- fotolab/__init__.py,sha256=MgF4Bm8__GfCAghI7CvQRO6IuZSuNoPHe7A8qJu5BME,2061
1
+ fotolab/__init__.py,sha256=N4xrOBEFOh1Zf1jqzJxDC8lraRJNXGnvL_m37a4JcAg,2061
2
2
  fotolab/__main__.py,sha256=aboOURPs_snOXTEWYR0q8oq1UTY9e-NxCd1j33V0wHI,833
3
3
  fotolab/animate.py,sha256=ejimhTozo9DN7BbqqcV4x8zLnanZRKq1pxBBFeOdr6Q,2967
4
4
  fotolab/auto.py,sha256=1Toxe8pA_tq15g1-imMFuHf1L94Ac7EthPTu7E8SAzE,2217
5
5
  fotolab/border.py,sha256=5ch2d7LVPhB2OFuuXSW5ci6Cn967CPDQu0qSfaO7uMg,3591
6
- fotolab/cli.py,sha256=hKlSoomuwhXsMOTWOxjASlt0a25kDOqu7Lsg6d5Elfs,4939
6
+ fotolab/cli.py,sha256=YudfGpAdd7FlNk9GOoJvPuBOURRBqc-lzQz3cxlCH20,5008
7
7
  fotolab/contrast.py,sha256=l7Bs5p8W8ypN9Cg3fFHnU-A20UwMKtjTiPk6D0PRwpM,2095
8
8
  fotolab/env.py,sha256=NTTvfISWBBfIw5opWrUfg0BtkaAtdUtcISBAJC2gVUk,1449
9
9
  fotolab/info.py,sha256=DawXTQJiQDBwy0Ml5Ysk8MvKga3ikp_aIw73AR3LdZo,1687
10
10
  fotolab/montage.py,sha256=lUVY-zDSH7mwH-s34_XefdNp7CoDJHkwpbTUGiyJGgs,2037
11
11
  fotolab/resize.py,sha256=cvPfh4wUfydM23Do7VnP6Bx2EqMHKfYFYrpiNhyWzCU,3259
12
+ fotolab/rotate.py,sha256=l_vQgf0IcI8AR1TSVsk4PrMZtJ3j_wpU77rKiGJ-KTA,1715
12
13
  fotolab/sharpen.py,sha256=wUPtJdtB6mCRmcHrA0CoEVO0O0ROBJWhejTvUeL67QU,2655
13
14
  fotolab/watermark.py,sha256=3yHqtrh6WtFcGArgrpKAL6849Y2R1Fk-g3FeKdejrz0,6513
14
- fotolab-0.15.0.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
15
- fotolab-0.15.0.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
16
- fotolab-0.15.0.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
17
- fotolab-0.15.0.dist-info/METADATA,sha256=mKiBo5IuAm5fp-mGW3Wz1ukk45QVfdaWcSwoOqU0KbY,9830
18
- fotolab-0.15.0.dist-info/RECORD,,
15
+ fotolab-0.16.1.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
16
+ fotolab-0.16.1.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
17
+ fotolab-0.16.1.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
18
+ fotolab-0.16.1.dist-info/METADATA,sha256=vli7NOwyaZ6s1F-2xBJGhd84SKxbmaMtrb7-iRc2_GE,10153
19
+ fotolab-0.16.1.dist-info/RECORD,,