fotolab 0.18.1__py2.py3-none-any.whl → 0.18.4__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 +1 -1
- fotolab/watermark.py +34 -31
- {fotolab-0.18.1.dist-info → fotolab-0.18.4.dist-info}/METADATA +1 -1
- {fotolab-0.18.1.dist-info → fotolab-0.18.4.dist-info}/RECORD +7 -7
- {fotolab-0.18.1.dist-info → fotolab-0.18.4.dist-info}/LICENSE.md +0 -0
- {fotolab-0.18.1.dist-info → fotolab-0.18.4.dist-info}/WHEEL +0 -0
- {fotolab-0.18.1.dist-info → fotolab-0.18.4.dist-info}/entry_points.txt +0 -0
fotolab/__init__.py
CHANGED
fotolab/watermark.py
CHANGED
@@ -157,44 +157,47 @@ def run(args: argparse.Namespace) -> None:
|
|
157
157
|
log.debug(args)
|
158
158
|
|
159
159
|
for image_filename in args.image_filenames:
|
160
|
-
|
161
|
-
watermarked_image
|
160
|
+
watermarked_image = watermark_image(image_filename, args)
|
161
|
+
save_image(args, watermarked_image, image_filename, "watermark")
|
162
162
|
|
163
|
-
draw = ImageDraw.Draw(watermarked_image)
|
164
163
|
|
165
|
-
|
166
|
-
|
164
|
+
def watermark_image(image_filename, args):
|
165
|
+
"""Watermark the image."""
|
166
|
+
original_image = Image.open(image_filename)
|
167
|
+
watermarked_image = original_image.copy()
|
167
168
|
|
168
|
-
|
169
|
-
if args.camera and camera_metadata(image_filename):
|
170
|
-
text = camera_metadata(image_filename)
|
169
|
+
draw = ImageDraw.Draw(watermarked_image)
|
171
170
|
|
172
|
-
|
173
|
-
|
171
|
+
font = ImageFont.load_default(calc_font_size(original_image, args))
|
172
|
+
log.debug("default font: %s", " ".join(font.getname()))
|
174
173
|
|
175
|
-
|
176
|
-
|
177
|
-
)
|
178
|
-
text_width = right - left
|
179
|
-
text_height = bottom - top
|
180
|
-
(position_x, position_y) = calc_position(
|
181
|
-
watermarked_image,
|
182
|
-
text_width,
|
183
|
-
text_height,
|
184
|
-
args.position,
|
185
|
-
calc_padding(original_image, args),
|
186
|
-
)
|
174
|
+
text = args.text
|
175
|
+
if args.camera and camera_metadata(image_filename):
|
176
|
+
text = camera_metadata(image_filename)
|
187
177
|
|
188
|
-
|
189
|
-
|
190
|
-
text,
|
191
|
-
font=font,
|
192
|
-
fill=(*ImageColor.getrgb(args.font_color), 128),
|
193
|
-
stroke_width=calc_font_outline_width(original_image, args),
|
194
|
-
stroke_fill=(*ImageColor.getrgb(args.outline_color), 128),
|
195
|
-
)
|
178
|
+
if args.lowercase:
|
179
|
+
text = text.lower()
|
196
180
|
|
197
|
-
|
181
|
+
(left, top, right, bottom) = draw.textbbox(xy=(0, 0), text=text, font=font)
|
182
|
+
text_width = right - left
|
183
|
+
text_height = bottom - top
|
184
|
+
(position_x, position_y) = calc_position(
|
185
|
+
watermarked_image,
|
186
|
+
text_width,
|
187
|
+
text_height,
|
188
|
+
args.position,
|
189
|
+
calc_padding(original_image, args),
|
190
|
+
)
|
191
|
+
|
192
|
+
draw.text(
|
193
|
+
(position_x, position_y),
|
194
|
+
text,
|
195
|
+
font=font,
|
196
|
+
fill=(*ImageColor.getrgb(args.font_color), 128),
|
197
|
+
stroke_width=calc_font_outline_width(original_image, args),
|
198
|
+
stroke_fill=(*ImageColor.getrgb(args.outline_color), 128),
|
199
|
+
)
|
200
|
+
return watermarked_image
|
198
201
|
|
199
202
|
|
200
203
|
def camera_metadata(image_filename):
|
@@ -1,4 +1,4 @@
|
|
1
|
-
fotolab/__init__.py,sha256=
|
1
|
+
fotolab/__init__.py,sha256=QfvhUv_TG0_NHbiDaoyO0xlAfhUMvTGH9pRgXQYVPMw,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=SmEEbTXFiP1BiqaAFxPNTcGguVSUbAmLbSuWf_LgsBY,2270
|
@@ -11,9 +11,9 @@ fotolab/montage.py,sha256=lUVY-zDSH7mwH-s34_XefdNp7CoDJHkwpbTUGiyJGgs,2037
|
|
11
11
|
fotolab/resize.py,sha256=cvPfh4wUfydM23Do7VnP6Bx2EqMHKfYFYrpiNhyWzCU,3259
|
12
12
|
fotolab/rotate.py,sha256=l_vQgf0IcI8AR1TSVsk4PrMZtJ3j_wpU77rKiGJ-KTA,1715
|
13
13
|
fotolab/sharpen.py,sha256=wUPtJdtB6mCRmcHrA0CoEVO0O0ROBJWhejTvUeL67QU,2655
|
14
|
-
fotolab/watermark.py,sha256=
|
15
|
-
fotolab-0.18.
|
16
|
-
fotolab-0.18.
|
17
|
-
fotolab-0.18.
|
18
|
-
fotolab-0.18.
|
19
|
-
fotolab-0.18.
|
14
|
+
fotolab/watermark.py,sha256=zxmTT1k78tdqqzbRu13YVOFQ0Z1cKd7JHU4M0nV01DU,7418
|
15
|
+
fotolab-0.18.4.dist-info/entry_points.txt,sha256=mvw7AY_yZkIyjAxPtHNed9X99NZeLnMxEeAfEJUbrCM,44
|
16
|
+
fotolab-0.18.4.dist-info/LICENSE.md,sha256=tGtFDwxWTjuR9syrJoSv1Hiffd2u8Tu8cYClfrXS_YU,31956
|
17
|
+
fotolab-0.18.4.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
|
18
|
+
fotolab-0.18.4.dist-info/METADATA,sha256=7zF_Jtmba82SK9yip3IJFa9uH9_es80Y4NMon2f0MMw,10676
|
19
|
+
fotolab-0.18.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|