A script to pair image and text files and write the text data to the image's XMP metadata.
Note
Prepare Your Files:
- Each image file should have a corresponding text file with the same name.
- For example:
01.png,01.txt,02.jpg,02.txt, etc.
- For example:
- Supported image formats:
png,jpg,jpeg,tiff
- Run the script.
- Enter the directory path to search for pairs of image and text files.
- The script will:
- Read each pair of files.
- Write the text data to the image's XMP metadata.
- The text data is written to the
dc:subjectfield in the XMP metadata. - If the field already exists, the script will overwrite it.
- The text data is written to the
- Print a message for each successful operation or error.
- If an error occurs, the script will continue processing the remaining pairs.
- Make backups before running the script.
- Supported image formats are:
.png,.jpg,.jpeg,.tiff. - The text data from the
.txtfiles will be written to thedc:subjectfield in the XMP metadata of the images. - Existing metadata in the
dc:subjectfield will be overwritten. - If you encounter permission errors, try running the script with administrative privileges.
- You can type
helpor?at the prompt to display the help message.
- Clone the repository:
git clone https://github.com/Nenotriple/image_text_xmp_writer.git
- Run
Start.batto create a virtual environment and install the required packages. - Run
python image_text_xmp_writer.pyto start the script.
- Update PyInstaller:
pip install --upgrade pyinstaller
- Build the script:
pyinstaller --onefile --add-binary "venv\Lib\site-packages\pyexiv2\lib;pyexiv2/lib" image_text_xmp_writer.py