Forum Discussion
Super easy way to put or watermark on a photo in bulk?
Mil-kit is a command-line tool that allows you to put watermark on a photo either as a static text or through a metadata-driven process . This makes it powerful for complex workflows where you need to put a watermark on a photo with different information for each image.
To use mil-kit, you'll first need to install it via pip: pip install mil-kit . Once installed, you can use the watermark command in a few ways:
1. Basic Bulk Watermark: To apply the same text to every image in a folder, you can use the following command:
bash
mil-kit watermark -d /path/to/images -t "© 2024 Your Name"
2. Dynamic Watermarking with Metadata: For a more complex scenario where you want to put watermark on a photo that is specific to each file, you can use a metadata file . This is an advanced feature where the tool matches the image filename against a column in an Excel or CSV file to apply a unique watermark .
bash
mil-kit watermark -d /path/to/images --meta-file /path/to/metadata.csv
3. Using a Fallback Watermark: You can also combine both methods. This allows you to use specific watermarks from a metadata file for some images, but automatically use a default fallback text for any others that aren't listed .
bash
mil-kit watermark -d /path/to/images --meta-file /path/to/metadata.csv -t "Default Watermark" --opacity 0.5
You can adjust the watermark's appearance, including its opacity, using the --opacity flag . For deeper control, mil-kit also provides a WatermarkProcessor class for use in Python scripts, allowing you to integrate the ability to put a watermark on a photo directly into your own code.