User:Lucas Werkmeister/Wikidata Image Positions

From Wikidata
Jump to navigation Jump to search
screenshot of the tool on a Commons file with Structured Data “depicts” statements

Wikidata Image Positions is a tool that shows relative position within image (P2677) qualifiers on depicts (P180) or named place on map (P9664) statements as areas on the relevant image, and also allows users to add new such qualifiers and statements. 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.

By item[edit]

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, and the tool will load the item and all its depicts (P180) and named place on map (P9664) 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) or named place on map (P9664) 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.

By file[edit]

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 (The 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 region[edit]

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, and the tool will search for all items with a depicts (P180) or named place on map (P9664) 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.

IIIF manifests[edit]

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 to try it out (example link), then click the icon on the left to show the annotations.

Specifying the language[edit]

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. 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.

Changing the image size[edit]

If the image is larger than your screen, then it is shown scaled down so it still fits on the screen. You can use the “Image scale” slider above the image to resize the image (“zoom in” or “zoom out”). This can be used to work with smaller regions on very detailed images, or to see details of a low-resolution image more easily. If the scaled image doesn’t fit on the screen, it will become scrollable by itself (separately from the rest of the page); depending on your browser and input methods, you may need to look for a second set of scrollbars to move the image around.

Editing (see below) works while the image is “zoomed in”, but you cannot change the image scale while a region is being edited: you have to scale the image to your needs before you start editing.

User script[edit]

screenshot of a file with “depicts” statements with the user script

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:

mw.loader.load( '' );

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.


If you’re logged in (you can log into the tool using this link or in the upper right corner of the tool), you can also use the tool to add relative position within image (P2677) qualifiers to depicts (P180) or named place on map (P9664) statements that don’t have such a qualifier yet, or to add new depicts (P180) or named place on map (P9664) statements.

Defining the region[edit]

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, or click the “cancel” button.

Editing existing regions[edit]

You can click the “Edit a region” button, and then click one of the existing regions, to select it for editing; 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 or click the “cancel” button to abort.

Adding new “depicts” statements[edit]

You can use the form at the bottom of the page to add new depicts (P180) or named place on map (P9664) 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.)


You can see all the edits made using this tool on the recent changes list of Wikidata and Commons.