| 1 |
#!/usr/bin/env python3 |
| 2 |
|
| 3 |
from pathlib import Path |
| 4 |
import os |
| 5 |
|
| 6 |
spath = os.path.dirname(os.path.realpath(__file__)) |
| 7 |
|
| 8 |
path = Path(spath) |
| 9 |
|
| 10 |
folder = "../../results/" |
| 11 |
|
| 12 |
images = list(path.glob(folder + '*.png')) |
| 13 |
|
| 14 |
images.sort() |
| 15 |
|
| 16 |
gallery = open(path.absolute().joinpath(folder + 'index.html'), 'w') |
| 17 |
|
| 18 |
gallery.write("""<html> |
| 19 |
<head> |
| 20 |
<script type="module" src="https://unpkg.com/img-comparison-slider@latest/dist/component/component.esm.js"></script> |
| 21 |
<script nomodule="" src="https://unpkg.com/img-comparison-slider@latest/dist/component/component.js"></script> |
| 22 |
<link rel="stylesheet" href="https://unpkg.com/img-comparison-slider@latest/dist/collection/styles/initial.css"/> |
| 23 |
<style> |
| 24 |
h2 { |
| 25 |
font-weight: normal; |
| 26 |
margin-top: 150px; |
| 27 |
margin-bottom: 20px; |
| 28 |
} |
| 29 |
a { |
| 30 |
text-decoration: none; |
| 31 |
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; |
| 32 |
color: blue; |
| 33 |
} |
| 34 |
a:hover { |
| 35 |
font-weight: bold; |
| 36 |
} |
| 37 |
</style> |
| 38 |
</head> |
| 39 |
<body> |
| 40 |
""") |
| 41 |
|
| 42 |
tag = '' |
| 43 |
|
| 44 |
for image in images: |
| 45 |
group = image.stem.rstrip('0123456789') |
| 46 |
before = f'https://filament-assets.github.io/golden/{group}/{image.name}' |
| 47 |
after = image.name |
| 48 |
gallery.write('\n') |
| 49 |
gallery.write(f'<h2><a href="{image.stem}.json">{image.stem}.json</a></h2>\n') |
| 50 |
gallery.write('<img-comparison-slider>\n') |
| 51 |
gallery.write(f'<img slot="before" src="{before}" /> <img slot="after" src="{after}" />\n') |
| 52 |
gallery.write('</img-comparison-slider>\n') |
| 53 |
|
| 54 |
gallery.write("""</body> |
| 55 |
</html> |
| 56 |
""") |