diff --git a/index.html b/index.html index bf55d46..7237099 100644 --- a/index.html +++ b/index.html @@ -14,7 +14,7 @@ #slider { position: relative; width: 100%; - margin-bottom:3em; + margin-bottom:1em; } @@ -51,22 +51,35 @@ { "city": "Hamburg", "lat": "53.64286", - "lng": "9.9753" + "lng": "9.9753", + "icon": "test5.png", + "anchor": [101,101] }, // { // "city": "Kiel", // "lat": "54.3297", // "lng": "10.1435" // }, + // { + // "city": "München", + // "lat": "48.1341", + // "lng": "11.5674", + // "icon": "test8.png", + // "anchor": [144,144] + // }, { - "city": "München", - "lat": "48.1341", - "lng": "11.5674" + "city": "La Spezia", + "lat": "44.1064", + "lng": "9.8439", + "icon": "test8.png", + "anchor": [144,144] }, { "city": "Teisnach", "lat": "49.0301", - "lng": "12.998" + "lng": "12.998", + "icon": "test13.png", + "anchor": [144,144] } ]; @@ -74,8 +87,8 @@ const markers = locations.map(location => { return L.marker([location.lat, location.lng], {icon: L.icon({ - iconUrl: location.city + "64.png", - iconAnchor: [32,32] + iconUrl: location.icon, + iconAnchor: location.anchor })}).addTo(map); }); diff --git a/mappersons.py b/mappersons.py index 33732fd..cd8d47b 100644 --- a/mappersons.py +++ b/mappersons.py @@ -17,13 +17,13 @@ def circular_mask(img): return img -def arrange_imager_in_circle(images, spacing=5): +def arrange_imager_in_circle(images, spacing=5, min_radius=0): d = images[0].size[0] dis = d + spacing theta = 2*math.pi / len(images) - radius = dis/2/math.sin(theta/2) + radius = max(dis/2/math.sin(theta/2), min_radius) imgWidth, imgHeight = (int(d+radius*2), int(d+radius*2)) masterImage = Image.new("RGBA", (imgWidth, imgHeight), (255,255,255,0)) @@ -62,7 +62,21 @@ def create_circle(image_paths, output_path): circular_images[0].save(output_path) return - output_img = arrange_imager_in_circle(circular_images) + if len(circular_images) < 7: + output_img = arrange_imager_in_circle(circular_images) + ow, oh = output_img.size + else: + inner_img = arrange_imager_in_circle(circular_images[:4]) + iw, ih = inner_img.size + mask = inner_img.split()[-1] + dr = circular_images[0].size[0]//2 + iw//2 + output_img = arrange_imager_in_circle(circular_images[4:],min_radius=dr) + ow, oh = output_img.size + output_img.paste(inner_img,((ow-iw)//2,(oh-ih)//2),mask) + + draw = ImageDraw.Draw(output_img) + dr = 3 + draw.ellipse((ow//2-dr, oh//2-dr, ow//2+dr, oh//2+dr),fill=(255,0,0),outline=False) output_path = output_img.save(output_path)