File size: 1,879 Bytes
3d2f52d
 
fc29633
 
 
 
 
 
 
 
 
3d2f52d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fc29633
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
---
license: apache-2.0
task_categories:
- text-classification
language:
- aa
tags:
- art
pretty_name: rafa
size_categories:
- 1K<n<10K
---
<!DOCTYPE html>
<html lang="pt-BR">
<head>
  <meta charset="UTF-8">
  <title>Image Auto Editor</title>
  <style>
    body {
      background: #0f0f0f;
      color: #fff;
      font-family: Arial, sans-serif;
      text-align: center;
      padding: 30px;
    }
    canvas, img {
      max-width: 90%;
      margin-top: 20px;
      border-radius: 10px;
    }
    input {
      margin-top: 20px;
    }
  </style>
</head>
<body>

  <h2>Colar ou Enviar Imagem</h2>

  <input type="file" id="upload" accept="image/*">

  <canvas id="canvas"></canvas>

  <script>
    const upload = document.getElementById("upload");
    const canvas = document.getElementById("canvas");
    const ctx = canvas.getContext("2d");

    upload.addEventListener("change", (e) => {
      const file = e.target.files[0];
      if (!file) return;

      const img = new Image();
      img.onload = () => {
        canvas.width = img.width;
        canvas.height = img.height;

        // EFEITO AUTOMÁTICO
        ctx.filter = "contrast(110%) saturate(115%) sharpen(1)";
        ctx.drawImage(img, 0, 0);
      };

      img.src = URL.createObjectURL(file);
    });

    // COLAR IMAGEM (CTRL + V)
    document.addEventListener("paste", (event) => {
      const items = event.clipboardData.items;
      for (let item of items) {
        if (item.type.includes("image")) {
          const blob = item.getAsFile();
          const img = new Image();
          img.onload = () => {
            canvas.width = img.width;
            canvas.height = img.height;
            ctx.filter = "contrast(110%) saturate(115%)";
            ctx.drawImage(img, 0, 0);
          };
          img.src = URL.createObjectURL(blob);
        }
      }
    });
  </script>

</body>
</html>