From f222a8493a4e73562712521ddf21c7dc905ee870 Mon Sep 17 00:00:00 2001 From: Mike Bennett Date: Thu, 1 Jun 2023 17:01:46 +0200 Subject: [PATCH] Add recipe 0261 --- .../0261-non-rectangular-commenting.md | 10 ++++++++ ...0261-non-rectangular-commenting-method1.py | 24 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 docs/recipes/0261-non-rectangular-commenting.md create mode 100644 docs/recipes/scripts/0261-non-rectangular-commenting-method1.py diff --git a/docs/recipes/0261-non-rectangular-commenting.md b/docs/recipes/0261-non-rectangular-commenting.md new file mode 100644 index 0000000..c1d272d --- /dev/null +++ b/docs/recipes/0261-non-rectangular-commenting.md @@ -0,0 +1,10 @@ +# Annotation with a Non-Rectangular Polygon +| | **Cookbook URLs** | +|--------------|-------------------| +| **Recipe:** | [https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/](https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/) | +| **JSON-LD:** | [https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/manifest.json](https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/manifest.json) | + +### Method 1 - +```python +--8<-- "docs/recipes/scripts/0261-non-rectangular-commenting-method1.py" +``` \ No newline at end of file diff --git a/docs/recipes/scripts/0261-non-rectangular-commenting-method1.py b/docs/recipes/scripts/0261-non-rectangular-commenting-method1.py new file mode 100644 index 0000000..dd91998 --- /dev/null +++ b/docs/recipes/scripts/0261-non-rectangular-commenting-method1.py @@ -0,0 +1,24 @@ +from iiif_prezi3 import Manifest, config + +config.configs['helpers.auto_fields.AutoLang'].auto_lang = "en" + +manifest = Manifest(id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/manifest.json", label="Picture of Göttingen taken during the 2019 IIIF Conference") +canvas = manifest.make_canvas_from_iiif(url="https://iiif.io/api/image/3.0/example/reference/918ecd18c2592080851777620de9bcb5-gottingen", + id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/canvas/p1", + anno_id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/annotation/p0001-image", + anno_page_id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/page/p1/1") +anno = canvas.make_annotation(id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/annotation/p0002-svg", + motivation="tagging", + body={"type": "TextualBody", + "language": "de", + "format": "text/plain", + "value": "Gänseliesel-Brunnen"}, + target={"type": "SpecificResource", + "source": canvas.id, + "selector": {"type": "SvgSelector", + "value": "" + } + }, + anno_page_id="https://iiif.io/api/cookbook/recipe/0261-non-rectangular-commenting/page/p2/1") + +print(manifest.json(indent=2))