Calculator Tools Calculator Tools
Create

Editor de Imagens

Jan 5, 2024

About this app

Um editor de imagens com os efeitos Caneta Mágica e Colorido.

Editor de Imagens Editor de Imagens Caneta Mágica Colorido

Related apps

Put this on your site

Source

                    <html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">

<title>Editor de Imagens</title>
<meta name="description" content="Um editor de imagens com os efeitos Caneta Mágica e Colorido.">
<meta name="keywords" content="editor de imagens, caneta mágica, colorido">

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">

<script type="text/javascript">
try {
// App Javascript Goes Here. Place your entire script content inside the try block for error handling.
document.addEventListener("DOMContentLoaded", function() {
// Function to handle the image upload
function handleImageUpload(event) {
const file = event.target.files[0];
const reader = new FileReader();
reader.onload = function(event) {
const imageUrl = event.target.result;
const imageElement = document.createElement("img");
imageElement.src = imageUrl;
imageElement.classList.add("img-fluid");
document.getElementById("image-container").appendChild(imageElement);
}
reader.readAsDataURL(file);
}

// Event listener for image upload
document.getElementById("image-upload").addEventListener("change", handleImageUpload);

// Function to apply Magic Pen effect
function applyMagicPen() {
const imageElement = document.querySelector("#image-container img");
if (imageElement) {
imageElement.classList.toggle("magic-pen");
}
}

// Event listener for Magic Pen button
document.getElementById("magic-pen-button").addEventListener("click", applyMagicPen);

// Function to apply Colorful effect
function applyColorful() {
const imageElement = document.querySelector("#image-container img");
if (imageElement) {
imageElement.classList.toggle("colorful");
}
}

// Event listener for Colorful button
document.getElementById("colorful-button").addEventListener("click", applyColorful);
});

} catch (error) {
// This will throw the error to the parent window.
throw error;
}
</script>

<style>
/* App CSS Goes Here */
#image-container {
margin-top: 20px;
text-align: center;
}

.img-fluid {
max-width: 100%;
height: auto;
}

.magic-pen {
filter: invert(100%);
}

.colorful {
filter: contrast(200%);
}

.btn {
margin-right: 10px;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<h1>Editor de Imagens</h1>
<div>
<input type="file" id="image-upload">
</div>
<div id="image-container"></div>
<div>
<button id="magic-pen-button" class="btn btn-primary">Caneta Mágica</button>
<button id="colorful-button" class="btn btn-primary">Colorido</button>
</div>
</div>
</body>
</html>