-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
310 lines (272 loc) · 10 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>WebP to PNG Converter</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="index, follow">
<link rel="canonical" href="https://www.hatewebp.com" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<meta http-equiv="content-language" content="en">
<meta name="theme-color" content="#0d1117">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="theme-color" content="#0d1117" media="(prefers-color-scheme: dark)">
<meta http-equiv="Cross-Origin-Embedder-Policy" content="require-corp">
<meta http-equiv="Cross-Origin-Opener-Policy" content="same-origin">
<!-- SEO Meta Tags -->
<meta name="description" content="An actually good image converter.">
<meta name="keywords" content="webp to png, convert webp to png, heic to png, webp converter, webp image converter, webp online converter, webp free converter">
<!-- Open Graph Tags -->
<meta property="og:title" content="WebP to PNG Converter - With No BS">
<meta property="og:description" content="An actually good webp to png converter.">
<meta property="og:type" content="website">
<meta property="og:url" content="https://www.hatewebp.com">
<script src="heic2any.js"></script>
<!-- Structured Data -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "WebP to PNG Converter",
"description": "Free online tool to convert WebP, heic etc images to PNG format",
"url": "https://www.hatewebp.com",
"applicationCategory": "Utility",
"operatingSystem": "Any",
"offers": {
"@type": "Offer",
"price": "0"
},
"featureList": [
"Convert WebP to PNG",
"Free to use",
"No registration required",
"Browser-based conversion",
"No file upload needed"
]
}
</script>
<!-- Google search console -->
<meta name="google-site-verification" content="7wsYwvBo26I_3JLzKUHMBBB5Q2I4s94BHDHYmVgwQxs" />
<!-- Google Adsense -->
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-6232235554824221" crossorigin="anonymous"></script>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
<style>
:root {
color-scheme: dark;
--bg-primary: #0d1117;
--bg-secondary: #161b22;
--text-primary: #ffffff;
--text-secondary: #8b949e;
--accent: #3a4147;
--accent-hover: #454c53;
--border: #30363d;
--blue: #c4dcff;
}
html {
background: linear-gradient(#0d1117, #161b22);
min-height: 100vh;
}
body {
font-family: 'Roboto' ,system-ui, -apple-system, sans-serif;
letter-spacing: 1px;
line-height: 1.6;
max-width: 800px;
margin: 0 auto;
padding: 20px;
color: var(--text-primary);
overscroll-behavior: none;
-webkit-overflow-scrolling: touch;
}
h1 {
color: var(--text-primary);
margin-bottom: 15px;
font-size: 2.5rem;
letter-spacing: -0.25px;
}
@media screen and (max-width: 768px) {
h1 {
font-size: 1.6rem;
}
}
@media screen and (max-width: 480px) {
h1 {
font-size: 1.3rem;
}
}
.subtitle {
color: var(--text-secondary);
font-size: 1.1rem;
margin-bottom: 40px;
}
.small {
font-size: 0.8rem !important;
}
.features {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px;
margin: 30px 0;
}
.feature {
padding: 24px;
background: var(--bg-secondary);
border-radius: 12px;
text-align: left;
}
.feature h3 {
color: var(--blue);
margin-bottom: 10px;
font-size: 1.2rem;
}
.feature p {
color: var(--text-secondary);
}
.drop-zone {
border: 2px dashed var(--border);
border-radius: 12px;
padding: 40px 20px;
text-align: center;
margin: 20px 0;
background: var(--bg-secondary);
cursor: pointer;
transition: all 0.3s ease;
}
.drop-zone:hover {
border-color: var(--blue);
}
.drop-zone.dragover {
border-color: var(--blue);
background: var(--bg-secondary);
}
.drop-zone p {
color: var(--text-secondary);
}
#preview {
max-width: 100%;
margin: 20px 0;
display: none;
border-radius: 8px;
}
button {
background: var(--accent);
color: var(--text-primary);
border: none;
padding: 12px 28px;
border-radius: 8px;
cursor: pointer;
font-size: 16px;
transition: all 0.3s ease;
margin-top: 20px;
}
button:hover {
background: var(--accent-hover);
}
button:disabled {
background: var(--bg-secondary);
color: var(--text-secondary);
cursor: not-allowed;
}
.ad-container {
margin: 20px 0;
text-align: center;
min-height: 140px;
border-radius: 12px;
padding: 1px;
}
</style>
</head>
<body>
<h1>An Actually Good WEBP To PNG Converter</h1>
<p class="subtitle">Convert your WebP images to PNG format instantly. No internet connection required.</p>
<div class="drop-zone" id="dropZone">
<p>Drag & drop image here or click here to select file</p>
<input type="file" id="fileInput" accept="image/webp,image/*" style="display: none">
</div>
<p class="subtitle small"> Also supports HEIC, AVIF and most other common image types to PNG. </p>
<button id="convertBtn" disabled>Convert To PNG </button>
<!-- Bottom Ad -->
<div class="ad-container">
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-6232235554824221"
data-ad-slot="9872193613"
data-ad-format="auto"
data-full-width-responsive="true"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<img id="preview" alt="Image preview">
<script>
const dropZone = document.getElementById('dropZone');
const fileInput = document.getElementById('fileInput');
const preview = document.getElementById('preview');
const convertBtn = document.getElementById('convertBtn');
// Handle drag and drop
dropZone.addEventListener('dragover', (e) => {
e.preventDefault();
dropZone.classList.add('dragover');
});
dropZone.addEventListener('dragleave', () => {
dropZone.classList.remove('dragover');
});
dropZone.addEventListener('drop', (e) => {
e.preventDefault();
dropZone.classList.remove('dragover');
handleFile(e.dataTransfer.files[0]);
});
dropZone.addEventListener('click', () => {
fileInput.click();
});
fileInput.addEventListener('change', (e) => {
handleFile(e.target.files[0]);
});
async function handleFile(file) {
// Check if it's a HEIC file
if (file.type === 'image/heic' || file.name.toLowerCase().endsWith('.heic')) {
// Convert HEIC to BLOB
const conversionResult = await heic2any({
blob: file,
toType: "image/png"
});
// Create a new file from the converted blob
file = new File([conversionResult], file.name.replace('.heic', '.png'), {
type: 'image/png'
});
}
if (!file || !file.type.startsWith('image/')) {
alert('Please select a valid image file.');
return;
}
const reader = new FileReader();
reader.onload = (e) => {
preview.src = e.target.result;
preview.style.display = 'block';
convertBtn.disabled = false;
};
reader.readAsDataURL(file);
}
convertBtn.addEventListener('click', () => {
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
canvas.width = preview.naturalWidth;
canvas.height = preview.naturalHeight;
ctx.drawImage(preview, 0, 0);
canvas.toBlob((blob) => {
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
let fileName = fileInput.files[0].name;
let newFileName = fileName.replace(/\.(webp|avif|jpg|jpeg|gif|bmp|tiff|svg|heic)$/i, '.png');
a.download = newFileName;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
}, 'image/png');
});
</script>
</body>
</html>