Skip to main content

Simple XMP Image Tag & Metadata Editing Library

Project description

ImgTag

Simple XMP Image Tag & Metadata Editing Module

It is recomended to install using Conda to create a virtual python environment, as it makes it easy to install and manage different packages. Use the following commands to set up an environment:

conda env create -f environment.yml
conda activate imgtag

If you choose to install manually, you must install exempi for your OS.

For Debian:

sudo apt-get install -y exempi

For a Conda environment:

conda install -c conda-forge exempi

Once exempi is installed, install imgtag with:

python3 -m pip install -y imgtag

To use imgtag:

from imgtag import ImgTag

# Open image for tag editing
test = ImgTag(
           filename="test.jpg",   # The image file
           force_case="lower",    # Converts the case of all tags
                                  # Can be `None`, `"lower"`, `"upper"`
                                  # Default: None
           strip=True,            # Strips whitespace from the ends of all tags
                                  # Default: True
           no_duplicates=True,    # Removes all duplicate tags (case sensitive)
                                  # Default: True
           use_warnings=True      # Toggles warnings
                                  # Default: True
           memory_limit_ratio=0.8 # The maximum percent of free memory to use
                                  # Default: 0.8
       )

# Print existing tags
print("Current tags:")
for tag in test.get_tags():
    print("  Tag:", tag)

# Add tags
test.add_tags(["sleepy", "happy"])

# Remove tags
test.remove_tags(["cute"])

# Set tags, removing all existing tags
test.set_tags(["dog", "good boy"])

# Save changes and close file
test.close()

# Re-open for tag editing
test.open()

# Remove all tags
test.clear_tags()

# Delete the ImgTag object, automatically saving and closing the file
del(test)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imgtag-1.1.5.tar.gz (17.2 kB view details)

Uploaded Source

File details

Details for the file imgtag-1.1.5.tar.gz.

File metadata

  • Download URL: imgtag-1.1.5.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.7

File hashes

Hashes for imgtag-1.1.5.tar.gz
Algorithm Hash digest
SHA256 3d683c10cd567b35d909c988fb425ba9ea10fb9acefed1e8a0a8ab3d84501113
MD5 4ae700015e39d24c74e3e2725279ddb5
BLAKE2b-256 5810e26831e38de049d9725e458102adf55952634bc3c81d2c89dbb759f3ba72

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page