User:Lucas Werkmeister/Wikidata Image Positions
Wikidata Image Positions is a tool that shows relative position within image (P2677) qualifiers on depicts (P180) statements as areas on the relevant image, and also allows users to add new such qualifiers for depicts (P180) statements that don’t have them yet. For statements on Wikidata items, the areas apply to the item’s image (P18) (or other property); for statements on Structured Data on Commons files, they apply to the file itself.
There are three ways to use the tool to view positions: by item, by file, or by IIIF region (i. e., relative position within image (P2677) value). Additionally, you can use it in combination with IIIF-based tools.
This is the most straightforward way to use the tool. You enter an item ID into the first form on the index page, or append it directly to the URL https://wd-image-positions.toolforge.org/item/, and the tool will load the item and all its depicts (P180) statements and show you the item’s best image (P18) (respecting rank) with the depicted items on top of it, according to their relative position within image (P2677) qualifiers. (The depicted items are only visible when you hover the mouse over the image. If you’re on mobile, uh, uhhhm… oh look, over there, a distraction!) Any depicts (P180) statements without such qualifiers will be listed below the image.
If the image is specified in a different property than image (P18), enter that property ID into the form as well, or append it to the URL after another slash.
This works similarly to the previous section,
but you use the second form on the index page to specify the file name,
or append it to the URL https://wd-image-positions.toolforge.org/file/.
File: namespace is optional – if you include it, you’ll be redirected to the URL without it.)
The image used is always the file itself, so there’s no option to select any property that contains the image.
By IIIF regionEdit
This mode of the tool is useful mainly as the formatter URL for relative position within image (P2677). You enter a relative position within image (P2677) value into the second form on the index page, or append it directly to the URL https://wd-image-positions.toolforge.org/iiif_region/, and the tool will search for all items with a depicts (P180) statement and relative position within image (P2677) qualifier matching that value and list them on one page, very similar to the “by item” mode. (Most likely, there’s only one matching item, in which case the result looks identical.)
As in “by item” mode, you can specify a different property than image (P18), though I’m not sure when that would be useful.
The tool can also generate manifests for the International Image Interoperability Framework.
The manifest URL is
and an example tool where you can use it is Mirador –
append the manifest URL to the URL https://iiif.si.edu/mirador/?manifest= to try it out
then click the icon on the left to show the annotations.
Specifying the languageEdit
By default, the tool displays item labels in your browser’s preferred languages. To select different languages, you can add uselang parameters to the URL, e. g. https://wd-image-positions.toolforge.org/item/Q1231009?uselang=de-at&uselang=de. Note that the tool doesn’t support any kind of language fallbacks (except that English labels are always used as a last resort before falling back to the plain item ID), so any fallbacks you want need to be encoded explicitly in the URL (like the fallback “Austrian German” → “German” in the last example).
The tool’s UI is not translated, by the way, in case you’re wondering. This section only applies to the item labels.
For Wikimedia Commons files with depicts (P180) statements, there is also a user script that will show the equivalent of this tool directly on the Commons page itself. To use it, add the following line to your common.js:
The user script also adds an “add a Structured Data region” button, next to ImageAnnotator’s “add a note” button, that will send you to the tool where you can define additional regions.
The user script requires the ImageAnnotator gadget to work correctly; for that reason, it currently doesn’t work in the Minerva skin.
Defining the regionEdit
To define a new region, click the “add region” button after any of the “depicted, but with no region qualified” items listed below the image. Wait for the “cropper” UI to appear (it’s the same library that’s also used for CropTool), then define the region as desired, either dragging the corners or edges to adjust the region, or clicking and dragging outside the region to replace it. (Tip: briefly click-and-drag in one of the corners to get rid of the default region, then click-and-drag again where you actually want a region, and then adjust the edges if necessary.) When you’re happy with the indicated region, click the “use this region” button (which used to be the “add region” button). If you’re not happy with the region and want to try again, press the Esc key to abort.
Adding the region with QuickStatementsEdit
If you are not logged into the tool, then once you click the “use this region” button, the tool will ask you if you want the resulting region copied into your clipboard. (If you currently have anything important in the clipboard that you don’t want to lose, cancel here, otherwise it will be overwritten.) If you confirm, it will be copied into your clipboard using QuickStatements syntax; you can then go to the Quickstatements tool and paste the new region there (in “V1” syntax). If you want, you can collect several regions in one QuickStatements batch by continuing to draw regions and paste them into the tool before you actually make the edits. (If you’re working with a file on Commons, rather than a Wikidata item, make sure the QuickStatements batch is also targeting Commons.)
Adding the region directlyEdit
You can also log into the tool, using the “login” link in the upper right corner. Once you’re logged in, when you click the “use this region” button, the corresponding qualifier will be added immediately.
Editing existing regionsEdit
If you’re logged into the tool, it will also show you a button to “Edit a region”. Click the button, and then click one of the existing regions to select it; it will be replaced with a “cropper” UI, where you can edit the region like when adding it. When you’re happy with the new region, click the button again (it will now be labeled “use this region”), and the statement will be updated accordingly. If you change your mind or made a mistake, press the Esc key to abort.
Adding new “depicts” statementsEdit
If you’re logged into the tool, it will also show you a form at the bottom of the page to add new depicts (P180) statements. Select the item, click the “add” button (or press Enter), and then a new entry will appear in the list of depicted items with no relative position within image (P2677) qualifier yet. Afterwards, you can define the region as described above. (This always results in two edits, one for the new statement and one for adding the qualifier.) You can also click the “unknown value” button to add a new unknown value Help statement, rather than a statement with a certain item value, and afterwards define its region in the same way. (Other qualifiers for that statement need to be added separately, outside of this tool.)