Package: inqbus.tagging
IntroductionThis module allows automatic keyword tagging of multimedia content with a strong focus on images.Inqbus.tagging processes metadata of the following keyword sources: Filename/Title, EXIF, IPTC, XMP. Any Plone Object-Type can be processed.Keywords from FilenameThe metadata is filtered by configurable filters. For each metadata source there is a filter which can be switched on/off independently.The filename/title may be filtered by a regular expression you are free to craft. The regular expression enables you to filter, strip, split into words, what you like.
You can decide if you like to have new keywords to be extracted from the title or if you want use only keywords from the title that match existing ones, or both strategies with different regular expressions in parallel.Keywords from EXIF, IPTC and XMPEXIF, IPTC and XMP are filtered firstly by a positive list of tags for each category.For every tag in a filter can be defined a regular expression and a format string to cut and format the way you like. Lets assume you have metadata tags with the structure “Asimov, Isaac; Bradley, Alex” you can transform them into the Plone tags “Isaac Asimov” and “Alex Bradley” easily.Since there are lots of possible tags available inqbus.tagging comes with tag import views for each metadata category. Each tag import view allows for opening an arbitrary file in Plone to inspect its metadata and to select and transfer metadata tag names into the tag configuration.Improved manual tagging of imagesInqbus.tagging supports manual tagging of images by providing a preview image column in the folder_contents-View. Also inqbus.tagging brings lossless EXIF image auto rotation back to Plone.Retagging of already uploaded contentIf you have changed your autotagging config you can use the “retag” Button in the folder_contents-View to rerun the auto tagging on certain objects.StabiltyThis code is work in progress crafted in after hours. It may not be save for production sites, but runs fine in our setup.
We welcome anyone to improve the code.RequirementsPlone 5z3c.formsIPTCInfoexifreadjpegtran-cffi (libjpeg8, cython, cffi) for fast and loss less auto rotation.Note: If not using jpegtran the EXIF auto rotation falls back to PIL. The XMP-Metadata in auto rotated files then is lost since PIL does not respect XMP.Also the rotated images are larger and a bit blurred. So we strongly suggest to use jpegtran-cffi.Installation of jpegtran-cffiBuilding jpegtran-cffi on debian jessie:aptitude install build-essential python-dev libturbojpeg1-dev libjpeg62-turbo-dev libffi-dev
pip install cffi
pip install jpegtran-cffiInstallationAdd inqbus.tagging to your buildout eggs.:eggs=\
    ...
    inqbus.taggingTo use inqbus.tagging withjpegtran-cffiadd inqbus.tagging[jpegtran] to your buildout eggs.:eggs=\
    ...
    inqbus.tagging[jpegtran]jpegtran-cffiis used for the rotation of the images. If you do not use it images
will be rotated usingPillow. This leads to metadata loss especially xmp-data.DeinstallationFor removing all stored configurations run the profileprofile-inqbus.tagging:purge.Then go to Configuration -> Extensions. Select uninstall inqbus.tagging.Using inqbus.taggingConfigure Auto-TaggingGo to Configuration -> inqbus.tagging Configuration:Select Tags by Tag ImportTo make selecting meta-information more easier, you can useInqbus Tagging - Tag Importsin Site Setup to select meta-fields.Therefore select an image and pressok. A list of available fields will be displayed
including the value of the selected image as example.Select your tags and press ok. All selected tags are added to the list inInqbus Tagging Settingsand can be configured there.Enable Auto-Tagging for other ContenttypesRegister a subscriber like:<subscriber
for="plone.app.contenttypes.content.Image
     zope.lifecycleevent.IObjectCreatedEvent"
handler="inqbus.tagging.subscriber.title_based.title_to_tag"
/>for every contenttype you want to tag.Manage existing TagsFor managing existing tags you can use a modified version ofProducts.PloneKeywordManager.Here you can join tags used for the same content or delete not wanted tags.Extended Folder_contents-ViewImage PreviewTo make working with Images more easier a preview-column was
added to thefolder_contents-View and can be selected like all other columns.RetagTo migrate existing objects you can use theRetag-Action in thefolder_contents-View.LimitationsProcessing XMP is done by parsing the RDF:XML-Data structure directly utilizing LXML.
Usually XMP is parsed by tools based on Adobe’s XMP-Toolkit which fiddles a lot with the tag values to make them appear
right. There seems to be no Python XMP-Lib out there which does not requires an image file name to process a file.
Even in the underlying C++ Code there appears no good entry point for processing image data from a ZODB-Blob. So we
decided to parse the XMP “by hand” and do without the Adobe corrections. So please be not disappointed if the XMP tags
you have applied to your image by Photoshop 10 years ago may come out a bit askew.BackgroundWe take part in a small foto group in germany. Our sitehttp://fotogruppe-altenstadt.depresents 20.000+ high
quality images tagged by 2000+ keywords under CC license. Using Plone for a long time we like to give back our knowledge
to the community.Changelog1.0.6Bugfix:(src/lxml/lxml.etree.c:47744)
IndexError: list index out of range1.0.5Removed entrypointsUpdated MANIFEST.in1.0.4Improved Documentation/ReadmeCorrected dependencies1.0.3Added MANIFEST.in to make package installable1.0.1 and 1.0.2Some smaller changes ind Readme and setup.py to improve the documentation1.0 - Initial releaseAutotagging for Images based on meta information and titleAutorotation for Images based on ExifPossibilities to configure AutotaggingManaging Keywords by a modified KeywordManagerRetaging and Previews for Folder-Contents-View