Add watermark-image in one or multiple images at once.
Project description
WaterMarkPy
WaterMarkPy is a simple free open-source library to add watermark in images. The WaterMarkPy keeps the watermark in the same locate and in the same size in the image despite of the image resolution, because the WaterMarkPy uses percent (%) unit to position the watermark.
To add a watermark in the center of one image, run:
from watermarkpy.watermark import WMImage
main_image = "img/ship.jpg"
watermark = "img/shipwm.jpg"
with Image.open(main_image) as main, Image.open(watermark) as wm:
wm = WMImage(main, wm)
img = wm.createWMCenter()
img.save("new.jpg", "JPEG")
To add a watermark in the center of one image with a different scale and alpha, run:
from watermarkpy.watermark import WMImage
main_image = "img/ship.jpg"
watermark = "img/shipwm.jpg"
with Image.open(main_image) as main, Image.open(watermark) as wm:
wm = WMImage(main, wm)
img = wm.createWMCenter(scale=25, alpha=120)
img.save("new.jpg", "JPEG")
Parameters:
scale = [0% - 100%]
alpha = [0 - 255]
To add a watermark in a diffente position, run:
from watermarkpy.watermark import WMImage
main_image = "img/ship.jpg"
watermark = "img/shipwm.jpg"
with Image.open(main_image) as main, Image.open(watermark) as wm:
wm = WMImage(main, wm)
img = wm.createWMCustom(marginTop=70 marginLeft=60, scale=25, alpha=120)
img.save("new.jpg", "JPEG")
Parameters:
marginTop = [0% - 100%]
marginLeft = [0% - 100%]
scale = [0% - 100%]
alpha = [0 - 255]
To add a watermark and improve the brightness based in the brightness of the background region, run:
from watermarkpy.watermark import WMImage
main_image = "img/ship.jpg"
watermark = "img/shipwm.jpg"
with Image.open(main_image) as main, Image.open(watermark) as wm:
wm = WMImage(main, wm)
img = wm.createWMCustom(marginTop=70 marginLeft=60, adjust_color=True)
img.save("new.jpg", "JPEG")
Parameters:
marginTop = [0% - 100%]
marginLeft = [0% - 100%]
adjust_color = [True, False]
To add a watermark in the center of one image, run:
python main.py -i name.bmp -w nameWM.png -o name_output
* -i: path to image
* -w: path to watermark image
* -o: name of the output image
To add a watermark in the center of multiples images in a folder, run:
python main.py -d imgs/ -w nameWM.png
* -d: path to folder
* -w: path to watermark image
To scale (resize) the watermark image and define a relative position in one image, run:
python main.py -i imgs/name.bmp -w nomeWM.png -s 10 -mt 25 -ml 25 -o name_output
* -i: path to image
* -w: path to watermark image
* -s: % scale size to watermark image
* -mt: position in % from TOP margin
* -ml: position in % from LEFT margin
* -o: name of the output image
To scale (resize) the watermark image and define a relative position in multiples image in a folder, run:
python main.py -d imgs/ -w nomeWM.png -s 30 -mt 25 -ml 25
* -d: path to folder
* -w: path to watermark image
* -s: % scale size to watermark image
* -mt: position in % from TOP margin
* -ml: position in % from LEFT margin
Parameters:
> -i path to image
>> ex: -i imagem/img.bmp
> -w path to watermark image
>> ex: -i imagem/wm.bmp
> -d path to folder with image
>> ex: -d imagem/
> -s scale/resize (in %) watermark considering the dimensions of the main image
>> ex: -s 30
> -mt Margin TOP in %.
>> ex: -mt 20
> -ml Margin LEFT in %.
>> ex: -ml 20
> -negative invert colors of the watermark considering bg color of the main image
>> ex: -negative
> -p Add a prefix in the name of output image in a batch operation.
>> ex: -p water
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file watermarkpy-image-0.9.0.tar.gz.
File metadata
- Download URL: watermarkpy-image-0.9.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0011b904adb16920509ccf67fc63cd7fb1b5c8b85c94a444f4e175eea85e206
|
|
| MD5 |
39586c087fa0f02871d9dcfbe6675584
|
|
| BLAKE2b-256 |
7ecb11818c55583b873e2ffc3cb45b85d2926a704be1bab1ef069286369c218b
|
File details
Details for the file watermarkpy_image-0.9.0-py3-none-any.whl.
File metadata
- Download URL: watermarkpy_image-0.9.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c3173b9920440a7f17be6805fc2691c4f94deb31e869f1226b83ace75b2ae62
|
|
| MD5 |
95ac22c25395a813fbdb15a3f4788779
|
|
| BLAKE2b-256 |
32aab37bf429e1c27c5acc2775984bc3d23257f9d597b349338c52c348f77582
|