Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@irv
irv / iiif-heatmap.py
Created January 25, 2021 10:25
Create heatmap from IIIF Image requests (incomplete)
from io import BytesIO
import re
import asyncio
import numpy as np
from aiohttp import ClientSession, ClientPayloadError
import requests
import itertools, operator
from PIL import Image
import cv2
import backoff
{
"@context":["http://iiif.io/api/auth/1/context.json","http://iiif.io/api/presentation/3/context.json"],
"id":"https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100053375788.0x000002/manifest.json",
"type":"Manifest",
"label":{"en":["C1186/385 C1186/386 American trip: interview with W. J. Petty"]},
"metadata": [
{
"label":{"en":["Full title"]},
"value":{"en":["American trip: interview with W. J. Petty"]}
},
{
"id": "https://ebook-test-manifests.netlify.com/collection/alice-in-wonderland/index.json",
"type": "Manifest",
"items": [
{
"id": "https://ebook-test-manifests.netlify.com/collection/alice-in-wonderland/index.json/canvas/0",
"type": "Canvas",
"items": [
{
@irv
irv / china.json
Last active January 9, 2020 14:26
{
"items" : [
{
"type" : "Canvas",
"id" : "https://adore.ugent.be/china/canvases/cheating",
"width" : 1052,
"duration" : 30,
"height" : 940,
"items" : [
{
@irv
irv / 500.json
Last active August 21, 2019 09:17
{
"@context":"http://iiif.io/api/presentation/2/context.json",
"@type":"sc:Manifest",
"@id":"http://www.example.org/iiif/book1/manifest",
"sequences" : [
{
"@id":"http://www.example.org/iiif/book1/sequence/normal",
"@type":"sc:Sequence",
"canvases": [
@irv
irv / C819_86.json
Last active July 2, 2019 14:35
C819/86
{
"@context" : [
"http://www.w3.org/ns/anno.jsonld",
"http://iiif.io/api/presentation/3/context.json"
],
"id" : "https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100057936273.0x000002/manifest.json",
"type" : "Manifest",
"label" : {
"en" : [
"C819/86 [No Title]"
@irv
irv / redacted.json
Last active December 3, 2020 12:40
{
"@context": [
"http://iiif.io/api/auth/1/context.json",
"http://www.w3.org/ns/anno.jsonld",
"http://iiif.io/api/presentation/3/context.json"
],
"behavior": [
"auto-advance"
],
"label": {
{
"@context": [
"http://www.w3.org/ns/anno.jsonld",
"http://iiif.io/api/presentation/3/context.json"
],
"id": "https://www.bl.uk/collection-items/3D3529D7-37E4-4B47-AB2A-4B21B9B4A1A9-manifest.json",
"type": "Manifest",
"label": {"@none": ["Paterson's British Itinerary"]},
"metadata": [
{
{
"@context":"http://iiif.io/api/presentation/3/context.json",
"id":"https://api.bl.uk/metadata/iiif/ark:/81055/vdc_100050842868.0x000002/manifest.json",
"type":"Manifest",
"label":{"en":["C1132/1 Nirvana Coca-Cola live"]},
"metadata": [
{
"label":{"en":["Title"]},
"value":{"en":["Nirvana Coca-Cola live"]}
},
@irv
irv / fulltext_annotations.json
Last active September 19, 2018 14:51
podcast full text from gentle
{
"id":"https://gist.github.com/irv/53018b335e190b63430a481df9e505fa/fulltext_annotations.json",
"items": [
{
"id": "http://example.org/podcast/annotation/0",
"type": "Annotation",
"motivation": "painting",
"body": {
"id": "http://example.org/podcast/annotation/0/word",
"type": "TextualBody",