Frise rousse minet branle

13,039 vues il y a 1 an 14:33
Catégories: Solo
Tags: #Roux

Description

```javascript const fileInput = document.getElementById('fileInput'); const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); fileInput.addEventListener('change', handleFileSelect); function handleFileSelect(event) { const file = event.target.files[0]; if (!file) return; const reader = new FileReader(); reader.onload = function (e) { const img = new Image(); img.onload = function () { // Canvas auf Bild-Größe setzen canvas.width = img.width; canvas.height = img.height; ctx.drawImage(img, 0, 0); // Grayscale const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); const data = imageData.data; for (let i = 0; i < data.length; i += 4) { const gray = data[i] * 0.299 + data[i + 1] * 0.587 + data[i + 2] * 0.114; data[i] = gray; data[i + 1] = gray; data[i + 2] = gray; } ctx.putImageData(imageData, 0, 0); }; img.src = e.target.result; }; reader.readAsDataURL(file); } ```

Plus de Vidéos Qui Pourraient Vous Plaire

Accueil