fotolab 0.29.1__py3-none-any.whl → 0.29.2__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 +1 -1
- fotolab/subcommands/halftone.py +6 -4
- fotolab/subcommands/info.py +7 -20
- {fotolab-0.29.1.dist-info → fotolab-0.29.2.dist-info}/METADATA +1 -1
- {fotolab-0.29.1.dist-info → fotolab-0.29.2.dist-info}/RECORD +8 -8
- {fotolab-0.29.1.dist-info → fotolab-0.29.2.dist-info}/LICENSE.md +0 -0
- {fotolab-0.29.1.dist-info → fotolab-0.29.2.dist-info}/WHEEL +0 -0
- {fotolab-0.29.1.dist-info → fotolab-0.29.2.dist-info}/entry_points.txt +0 -0
fotolab/__init__.py
CHANGED
fotolab/subcommands/halftone.py
CHANGED
@@ -141,11 +141,13 @@ def _draw_halftone_dot(
|
|
141
141
|
x = min(int(cell.col * cell.cellsize + cell.cellsize / 2), img_width - 1)
|
142
142
|
y = min(int(cell.row * cell.cellsize + cell.cellsize / 2), img_height - 1)
|
143
143
|
|
144
|
-
# Ensure coordinates are non-negative (shouldn't happen with current logic,
|
144
|
+
# Ensure coordinates are non-negative (shouldn't happen with current logic,
|
145
|
+
# but safe)
|
145
146
|
x = max(0, x)
|
146
147
|
y = max(0, y)
|
147
148
|
|
148
|
-
# Get pixel value (brightness or color) from the source image using clamped
|
149
|
+
# Get pixel value (brightness or color) from the source image using clamped
|
150
|
+
# coordinates
|
149
151
|
pixel_value = source_image.getpixel((x, y))
|
150
152
|
|
151
153
|
if grayscale:
|
@@ -160,8 +162,8 @@ def _draw_halftone_dot(
|
|
160
162
|
)
|
161
163
|
dot_fill = pixel_value # Use original color for color dots
|
162
164
|
|
163
|
-
# Calculate dot radius relative to cell size based on brightness
|
164
|
-
#
|
165
|
+
# Calculate dot radius relative to cell size based on brightness Max radius
|
166
|
+
# is half the cell size. Scale by brightness (0-255).
|
165
167
|
dot_radius = (brightness / 255.0) * (cell.cellsize / 2)
|
166
168
|
|
167
169
|
# Draw the dot
|
fotolab/subcommands/info.py
CHANGED
@@ -33,7 +33,6 @@ def build_subparser(subparsers) -> None:
|
|
33
33
|
dest="image_filename",
|
34
34
|
help="set the image filename",
|
35
35
|
type=str,
|
36
|
-
default=None,
|
37
36
|
metavar="IMAGE_FILENAME",
|
38
37
|
)
|
39
38
|
|
@@ -74,29 +73,22 @@ def run(args: argparse.Namespace) -> None:
|
|
74
73
|
"""
|
75
74
|
log.debug(args)
|
76
75
|
|
77
|
-
|
78
|
-
|
79
|
-
image = Image.open(args.image_filename)
|
76
|
+
with Image.open(args.image_filename) as image:
|
77
|
+
exif_tags = extract_exif_tags(image, args.sort)
|
80
78
|
|
81
|
-
|
79
|
+
if not exif_tags:
|
80
|
+
print("No metadata found!")
|
81
|
+
return
|
82
82
|
|
83
|
-
|
84
|
-
print("No metadata found!")
|
85
|
-
# Close the image if opened outside a 'with' block
|
86
|
-
image.close()
|
87
|
-
return
|
88
|
-
|
89
|
-
output_info = []
|
83
|
+
output_info = []
|
90
84
|
specific_info_requested = False
|
91
85
|
|
92
86
|
if args.camera:
|
93
87
|
specific_info_requested = True
|
94
|
-
# TODO: Add error handling for missing keys
|
95
88
|
output_info.append(camera_metadata(exif_tags))
|
96
89
|
|
97
90
|
if args.datetime:
|
98
91
|
specific_info_requested = True
|
99
|
-
# TODO: Add error handling for missing keys
|
100
92
|
output_info.append(datetime(exif_tags))
|
101
93
|
|
102
94
|
if specific_info_requested:
|
@@ -107,9 +99,6 @@ def run(args: argparse.Namespace) -> None:
|
|
107
99
|
for tag_name, tag_value in exif_tags.items():
|
108
100
|
print(f"{tag_name:<{tag_name_width}}: {tag_value}")
|
109
101
|
|
110
|
-
# Close the image if opened outside a 'with' block
|
111
|
-
image.close()
|
112
|
-
|
113
102
|
|
114
103
|
def extract_exif_tags(image: Image.Image, sort: bool = False) -> dict:
|
115
104
|
"""Extract Exif metadata from image."""
|
@@ -135,13 +124,11 @@ def extract_exif_tags(image: Image.Image, sort: bool = False) -> dict:
|
|
135
124
|
|
136
125
|
def datetime(exif_tags: dict):
|
137
126
|
"""Extract datetime metadata."""
|
138
|
-
|
139
|
-
return exif_tags["DateTime"]
|
127
|
+
return exif_tags.get("DateTime", "Not available")
|
140
128
|
|
141
129
|
|
142
130
|
def camera_metadata(exif_tags: dict):
|
143
131
|
"""Extract camera and model metadata."""
|
144
|
-
# TODO: Add error handling for missing keys
|
145
132
|
make = exif_tags.get("Make", "")
|
146
133
|
model = exif_tags.get("Model", "")
|
147
134
|
metadata = f"{make} {model}"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
fotolab/__init__.py,sha256=
|
1
|
+
fotolab/__init__.py,sha256=x3KFWNlsAU6oD0mfatPwnN0mtrqpZrMk6ndICOBKR8o,3262
|
2
2
|
fotolab/__main__.py,sha256=aboOURPs_snOXTEWYR0q8oq1UTY9e-NxCd1j33V0wHI,833
|
3
3
|
fotolab/cli.py,sha256=NH_u73SJhzwDJSRqpi1I4dc8wBfcqbDxNne3cio163A,4411
|
4
4
|
fotolab/subcommands/__init__.py,sha256=l3DlIaJ3u3jGjnC1H1yV8LZ_nPqOLJ6gikD4BCaMAQ0,1129
|
@@ -7,15 +7,15 @@ fotolab/subcommands/auto.py,sha256=ia-xegV1Z4HvYsbKgmTzf1NfNFdTDPWfZe7vQ1_90Ik,2
|
|
7
7
|
fotolab/subcommands/border.py,sha256=BS3BHytdWiNumxdKulKYK-WigbsKtPxECdvInUhUjSQ,4608
|
8
8
|
fotolab/subcommands/contrast.py,sha256=ZHTvAJhRYZjNTrkHRZq3O6wba3LS7QjH1BfiGf4ZvGY,3005
|
9
9
|
fotolab/subcommands/env.py,sha256=QoxRvzZKgmoHTUxDV4QYhdChCpMWs5TbXFY_qIpIQpE,1469
|
10
|
-
fotolab/subcommands/halftone.py,sha256=
|
11
|
-
fotolab/subcommands/info.py,sha256=
|
10
|
+
fotolab/subcommands/halftone.py,sha256=lt6RV0OuZkGs1LigTC1EcCCY42CocPFHWaJTDjJ5LFM,6693
|
11
|
+
fotolab/subcommands/info.py,sha256=vie578cEOesAyHohm0xCWwZBqXpblYJtdHGSyBgxsoU,3581
|
12
12
|
fotolab/subcommands/montage.py,sha256=d_3EcyRSFS8fKkczlHO8IRP-mrKhQUtkQndjfd0MKsc,2566
|
13
13
|
fotolab/subcommands/resize.py,sha256=UOb2rg_5ArRj0gxPTDOww_ix3tqJRC0W5b_S-Lt1G4w,5444
|
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=qRGUp1Lc22fZSJDFRqQGPiz8RSB293ebvOVTdsDLUE4,10351
|
17
|
-
fotolab-0.29.
|
18
|
-
fotolab-0.29.
|
19
|
-
fotolab-0.29.
|
20
|
-
fotolab-0.29.
|
21
|
-
fotolab-0.29.
|
17
|
+
fotolab-0.29.2.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
|
18
|
+
fotolab-0.29.2.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
19
|
+
fotolab-0.29.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
20
|
+
fotolab-0.29.2.dist-info/METADATA,sha256=GOyjpDfTCDNXKoRm2_ZB6fsc55dx5Ktfae4tFgtu8VI,12980
|
21
|
+
fotolab-0.29.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|