-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnga_open_object.py
78 lines (69 loc) · 1.94 KB
/
nga_open_object.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
class Object:
def __init__(
self,
source,
objectid,
title,
attribution,
beginyear,
endyear,
displaydate,
classification,
medium,
width,
height,
iiifurl,
):
self.source = source
self.objectid = objectid
self.title = title
self.attribution = attribution
self.beginyear = beginyear
self.endyear = endyear
self.displaydate = displaydate
self.classification = classification
self.medium = medium
self.width = width
self.height = height
self.iiifurl = iiifurl
self.imgurl_full = ""
self.imgurl_downsized = ""
self.imgurl_thumb = ""
self.fix_image_properties()
def fix_image_properties(self):
if self.width > 4096 or self.height > 4096:
if self.width > 4096:
self.width = 4096
if self.height > 4096:
self.height = 4096
self.imgurl_full = (
self.iiifurl
+ "/full/!"
+ self.width
+ ","
+ self.height
+ "/0/default.jpg"
)
else:
self.imgurl_full = (
self.iiifurl
+ "/full/"
+ self.width
+ ","
+ self.height
+ "/0/default.jpg"
)
if self.height > 1500 or self.width > 1500:
self.imgurl_downsized = (
self.iiifurl + "/full/!" + 1500 + "," + 1500 + "/0/default.jpg"
)
else:
self.imgurl_downsized = (
self.iiifurl
+ "/full/!"
+ self.width
+ ","
+ self.height
+ "/0/default.jpg"
)
self.imgurl_thumb = self.iiifurl + "/full/!200,200/0/default.jpg"