-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
152 lines (130 loc) · 4.63 KB
/
index.html
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
font-family: sans-serif;
background: #448;
color: white;
font-size: 150%;
}
#images {
margin-bottom: 20px;
width: 1024px;
height: 1024px;
position: relative;
}
#color_space {
width: 400px;
height: 400px;
margin: 20px;
position: relative;
background: conic-gradient(from 90deg, #0ff 0%, #00f 12.5%, #80f 25%, #f0f 37.5%, #f00 50%, #ff0 62.5%, #8f0 75%, #0f0 88%, #0ff 100%);
cursor: cell !important;
}
#color_space p, #value {
margin: 0;
text-shadow: 0 0 4px black;
z-index: 777;
position: absolute;
}
#value {
margin: 10px;
top: 0;
font-size: 32px;
}
#images, #color_space {
border: 2px solid rgba(255,255,255,0.8);
box-shadow: 0 0 50px rgba(0,0,0,0.5);
position: relative;
}
input {
max-width: 500px;
}
</style>
</head>
<body>
<div style="display: flex; flex-direction: row; justify-content: center; align-items: center; width:100%;">
<div id="images">
<img id="original" src="correction0_0_0.jpg" style="position: absolute; z-index: 7777; display: none;">
<img id="image" src="correction0_0_0.jpg" style="display: block;">
</div>
<div style="flex-grow: 1">
<div id="value">Original SDXL Output</div>
<div style="display: flex; flex-direction: column; justify-content: center; align-items: center;">
<div style="text-align: center; width:100%">
Maximize<br>
<input id="m" type="range" step="25" min="0" max="100" value="0" id="m" oninput="changeM(this);" style="width: 100%">
</div>
<div style="text-align: center; width:100%">
Color balancing<br>
<input id="c" type="range" step="10" min="0" max="100" value="0" id="m" oninput="changeC(this);" style="width: 100%">
</div>
<div style="text-align: center; width:100%">
Outlier removal<br>
<input id="o" type="range" step="10" min="0" max="100" value="0" id="m" oninput="changeO(this);" style="width: 100%">
</div>
<button type="button" id="compare" onmousedown="compare('block')" onmouseup="compare('none')" style="font-size: 120%">
Compare to original
</button>
</div>
</div>
</div>
<script>
// Get references to the elements
const imagesContainer = document.getElementById('images');
const colorSpace = document.getElementById('color_space');
let c = m = o = 0;
document.getElementById("c").value = 0;
document.getElementById("m").value = 0;
document.getElementById("o").value = 0;
// Function to update the displayed image based on mouse position
function updateImage(event) {
const containerRect = colorSpace.getBoundingClientRect();
const offsetX = event.clientX - containerRect.left;
const offsetY = event.clientY - containerRect.top;
const percentX = (offsetX / containerRect.width);
// Adjust the calculation for percentY to scale it to the range [0, 1]
const percentY = 1 - (offsetY / containerRect.height);
// Convert percent values to the range [0, 100]
c = Math.round(percentX * 10) * 10;
g = Math.round(percentY * 10) * 10;
display();
}
function display() {
if(c == 0 && m == 0 && o == 0) {
document.getElementById("value").innerHTML = "Original SDXL output";
} else {
document.getElementById("value").innerHTML = `Maximize: ${m} Outlier removal: ${o} Color balancing: ${c}`;
}
document.getElementById("image").src = `correction${m}_${c}_${o}.jpg`;
}
function changeM(element) {
m = element.value;
display();
}
function changeC(element) {
c = element.value;
display();
}
function changeO(element) {
o = element.value;
display();
}
function compare(display) {
document.getElementById("original").style.display = display;
}
display();
// Attach the updateImage function to the mousemove event on the color_space div
colorSpace.addEventListener('mousemove', updateImage);
</script>
</body>
</html>