(i) Functional realization effects:
Select the effect of the file:
Marks the location of the pre-added watermark:
(ii) Python code:
# -*l- coding:utf-8 * import os, io, sys, re, time, json from pandas import array import .backend_tkagg import matplotlib ('TkAgg') import as plt #from import imshow, ginput from PIL import Image, ImageEnhance, ImageFilter import wx import numpy as np import random class DirDialog(): def __init__(self): """Constructor""" .__init__(self, None, -1, u"Folder Selection Dialog") b = (self, -1, u"Please select a picture.") (wx.EVT_BUTTON, , b) def OnButton(self, event): # file_wildcard = "Paint files(*.paint)|*.paint|All files(*.*)|*.*" dlg = (self, u"Select folder", style=wx.DD_DEFAULT_STYLE) if () == wx.ID_OK: jpegname = () # Folder path print(jpegname) ('', k_a=str(jpegname)) () def sealmark(img_seal, img_new): try: data_a = ('')# Save address data img_source = str(data_a['k_a']) # The address of the original image im1 = (img_source) (im1) xy = (1) xo = xy[0][0] yo = xy[0][1] ks = [1] * 0.000478 wm = (img_seal) wm = ((int( * ks), int( * ks))) # * k=280 * ks layer = ('RGBA', , (0, 0, 0, 0)) (wm, (int(xo), int(yo))) newIm = (layer, im1, layer) (img_new) print(img_seal) except Exception as e: print(">>>>>>>>>>> sealMark EXCEPTION: " + str(e)) return False else: return True if __name__ == '__main__': frame = () app = DirDialog() () () sealmark("Watermarks\Watermarks" + str((10)) + ".png", "after_seal.jpg") #(10): randomly pick a PNG watermark image from the watermark library
(iii) Python packaged as an exe program:
In the terminal, typepyinstaller -F -w add_seal.py
C:\Users\Administrator\Desktop\seal>pyinstaller -F -w add_seal.py
(1) The following packing success message appears:
(2) The exe file appears in the \dist\ folder:
(3) Place the exe file in the main workspace folder and double-click to run it.
(4) Success!
(5) PS: Add icons to EXE files.
1. Find an icon file in ICO format: "" and put it in the project folder.
2, plus, for packing exe.
pyinstaller -F -w -i add_seal.py
3. Move the location of the exe and the icon will appear.
To this article on Python to achieve the specified location of the picture plus image watermark (with: Pyinstaller packaged into exe format) of the article is introduced to this, more related Python to achieve the specified location of the picture plus image watermark (with: Pyinstaller packaged into exe format) content, please search for my previous posts or continue to browse the following related articles I hope that I hope that you will support me more in the future!