AI Image Editor
Dec 23, 2023
v.0
An AI-powered image editor that can identify and remove lost pixels, enhance sharpness, and provide various editing features. AI Image editor Redo Lost pixels Sharpness Zoom Undo Manual adjustment

Versions  

Bugs  
None!

Get This App On Your Website

1. Copy the code above with the iframe and link.
2. Paste the code into your website.
3. Resize the iframe to fit your website.

Javascript, HTML, CSS Code

                <html>
<head>
<script type="text/javascript"> window.addEventListener('error', function(event) { var message = JSON.parse(JSON.stringify(event.message)); var source = event.filename; var lineno = event.lineno; var colno = event.colno; var error = event.error; window.parent.postMessage({ type: 'iframeError', details: { message: message, source: source, lineno: lineno, colno: colno, error: error ? error.stack : '' } }, '*'); }); window.addEventListener('unhandledrejection', function(event) { window.parent.postMessage({ type: 'iframePromiseRejection', details: { reason: event.reason } }, '*'); }); </script>

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

<title>AI Image Editor</title>
<meta name="description" content="An AI-powered image editor that can identify and remove lost pixels, enhance sharpness, and provide various editing features.">
<meta name="keywords" content="AI, image editor, lost pixels, sharpness, zoom, undo, redo, manual adjustment">

<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 {
document.addEventListener("DOMContentLoaded", function() {
// Constants
const MAX_PIXELS = 10;

// Variables
let image = null;
let editedImage = null;
let pixelCount = 1;
let colors = [];

// Event listeners
$("#pixel-count").on("change", function() {
pixelCount = parseInt($(this).val());
});

$("#upload-image").on("change", function(e) {
const file = e.target.files[0];
const reader = new FileReader();

reader.onload = function(event) {
$("#original-image").attr("src", event.target.result);
image = new Image();
image.src = event.target.result;
image.onload = function() {
updateEditedImage();
updateColors();
}
}

reader.readAsDataURL(file);
});

$("#undo-button").on("click", function() {
if (editedImage && editedImage.filters.length > 0) {
editedImage.filters.pop();
editedImage.applyFilters();
updateEditedImage();
}
});

$("#redo-button").on("click", function() {
if (editedImage && editedImage.undoneFilters.length > 0) {
const filter = editedImage.undoneFilters.pop();
editedImage.filters.push(filter);
editedImage.applyFilters();
updateEditedImage();
}
});

$("#zoom-in-button").on("click", function() {
if (editedImage) {
editedImage.scaleX *= 1.1;
editedImage.scaleY *= 1.1;
editedImage.applyFilters();
updateEditedImage();
}
});

$("#zoom-out-button").on("click", function() {
if (editedImage) {
editedImage.scaleX /= 1.1;
editedImage.scaleY /= 1.1;
editedImage.applyFilters();
updateEditedImage();
}
});

$("#sharpness-slider").on("input", function() {
const value = parseInt($(this).val());
if (editedImage) {
editedImage.filters.push(new fabric.Image.filters.Convolute({
matrix: [ 0, -1, 0, -1, 5, -1, 0, -1, 0 ],
opaque: true
}));
editedImage.applyFilters();
updateEditedImage();
}
});

$("#manual-adjustment-slider").on("input", function() {
const value = parseInt($(this).val());
if (editedImage) {
editedImage.filters.push(new fabric.Image.filters.Brightness({
brightness: value
}));
editedImage.applyFilters();
updateEditedImage();
}
});

// Functions
function updateEditedImage() {
if (image) {
const canvas = new fabric.Canvas("edited-image-canvas");
editedImage = new fabric.Image(image.getElement(), {
left: 0,
top: 0,
selectable: false
});
canvas.setWidth(editedImage.width);
canvas.setHeight(editedImage.height);
canvas.add(editedImage);
canvas.renderAll();
}
}

function updateColors() {
if (editedImage) {
const canvas = document.createElement("canvas");
const context = canvas.getContext("2d");
canvas.width = editedImage.width;
canvas.height = editedImage.height;
context.drawImage(editedImage._element, 0, 0);
const imageData = context.getImageData(0, 0, canvas.width, canvas.height).data;
const uniqueColors = new Set();
for (let i = 0; i < imageData.length; i += 4) {
const r = imageData[i];
const g = imageData[i + 1];
const b = imageData[i + 2];
const rgb = `${r},${g},${b}`;
uniqueColors.add(rgb);
}
colors = Array.from(uniqueColors);
$("#color-list").empty();
colors.forEach(color => {
const [r, g, b] = color.split(",");
const colorBox = `<div class="color-box" style="background-color: rgba(${r}, ${g}, ${b}, 1);"></div>`;
const colorText = `<span class="color-text">${color}</span>`;
const colorItem = `<li>${colorBox} ${colorText}</li>`;
$("#color-list").append(colorItem);
});
}
}
});

} catch (error) {
throw error;
}
</script>

<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f0f0f0;
margin: 0;
padding: 0;
}

h1 {
font-family: 'Open Sans', sans-serif;
font-weight: 700;
font-size: 28px;
color: #333;
margin: 20px 0;
}

.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
}

.form-group {
margin-bottom: 20px;
}

.image-upload {
border: 2px dashed #ccc;
border-radius: 5px;
padding: 20px;
text-align: center;
cursor: pointer;
}

#original-image {
max-width: 100%;
margin-top: 20px;
}

#edited-image-canvas {
border: 2px solid #ccc;
margin-top: 20px;
}

.color-box {
width: 20px;
height: 20px;
display: inline-block;
vertical-align: middle;
margin-right: 5px;
}

.color-text {
vertical-align: middle;
}

.toolbar {
margin-top: 20px;
display: flex;
justify-content: space-between;
}

.toolbar .btn {
margin-right: 10px;
}
</style>

<link rel="canonical" href="https://calculator.tools/app/ai-image-editor-849/">
<meta charset="utf-8">

</head>
<body>
<div id="main-container" class="container">
<h1>AI Image Editor</h1>

<div class="form-group">
<label for="pixel-count">Number of Pixels to Identify:</label>
<select id="pixel-count" class="form-control">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
</div>

<div class="form-group">
<label for="upload-image">Upload Image:</label>
<input type="file" id="upload-image" accept="image/*" class="form-control">
</div>

<h2>Original Image</h2>
<img id="original-image">

<h2>Edited Image</h2>
<canvas id="edited-image-canvas"></canvas>

<h2>Colors Used</h2>
<ul id="color-list"></ul>

<h2>Tools</h2>
<div class="toolbar">
<div>
<button id="undo-button" class="btn btn-primary" disabled><i class="fa fa-undo"></i> Undo</button>
<button id="redo-button" class="btn btn-primary" disabled><i class="fa fa-repeat"></i> Redo</button>
</div>
<div>
<button id="zoom-in-button" class="btn btn-primary" disabled><i class="fa fa-search-plus"></i> Zoom In</button>
<button id="zoom-out-button" class="btn btn-primary" disabled><i class="fa fa-search-minus"></i> Zoom Out</button>
</div>
</div>

<h2>Sharpness</h2>
<input type="range" id="sharpness-slider" min="0" max="100" value="0" class="form-range">

<h2>Manual Adjustment</h2>
<input type="range" id="manual-adjustment-slider" min="-100" max="100" value="0" class="form-range">
</div>
<script type="text/javascript"> var localStoragePrefix = "ct-849"; var lastSave = 0; function saveLocal(data) { if (Date.now() - lastSave < 1000) { return; } let cookie = localStoragePrefix + "=" + JSON.stringify(data) + "; path=" + window.location.pathname + "'; SameSite=Strict"; cookie += "; expires=" + new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 1000).toUTCString(); document.cookie = cookie; lastSave = Date.now(); } function loadLocal() { var cookiePrefix = localStoragePrefix + "="; var cookieStart = document.cookie.indexOf(cookiePrefix); if (cookieStart > -1) { let cookieEnd = document.cookie.indexOf(";", cookieStart); if (cookieEnd == -1) { cookieEnd = document.cookie.length; } var cookieData = document.cookie.substring(cookieStart + cookiePrefix.length, cookieEnd); return JSON.parse(cookieData); } } </script>
<script type="text/javascript"> window.addEventListener('load', function() { var observer = new MutationObserver(function() { window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); observer.observe(document.body, {attributes: true, childList: true, subtree: true}); window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); </script>
</body>
</html>

NEW APPS

These are apps made by the community!

FAQ

What is Calculator Tools?

Calculator Tools allows you to instantly create and generate any simple one page web app for free and immediately have it online to use and share. This means anything! Mini apps, calculators, trackers, tools, games, puzzles, screensavers... anything you can think of that the AI can handle.

The AI uses Javacript, HTML, and CSS programming to code your app up in moments. This currently uses GPT-4 the latest and most powerful version of the OpenAI GPT language model.

What Do You Mean Make An App?

Have you ever just wanted a simple app but didn't want to learn programming or pay someone to make it for you? Calculator Tools is the solution! Just type in your prompt and the AI will generate a simple app for you in seconds. You can then customize it to your liking and share it with your friends.

AI has become so powerful it is that simple these days.

Does This Use ChatGPT?

It uses GPT-4 which is the most powerful model for ChatGPT.

Calculator Tools does not remember things from prompt to prompt, each image is a unique image that does not reference any of the images or prompts previously supplied.