Pixel Fruit Generator
Dec 23, 2023
v.0
Generate pixel art fruit images with custom pixel size. Generator Pixel art Fruit Images

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

                
<!DOCTYPE html>
<html lang="es">
<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 name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pixelizar imagen</title>
<meta name="description" content="Pixeliza una imagen con este sencillo generador.">
<meta name="keywords" content="pixelizar, imagen, generador">
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Roboto', sans-serif;
text-align: center;
}

h1 {
color: #ff4081;
margin-top: 50px;
}

.container {
margin-top: 50px;
}

.image-container {
display: flex;
justify-content: center;
margin-top: 30px;
}

.controls {
display: flex;
justify-content: center;
margin-top: 20px;
}

.control-input {
margin: 0 10px;
}

.pixelate-btn {
background-color: #ff4081;
color: white;
font-size: 18px;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}

.pixelate-btn:hover {
background-color: #e91e63;
}

.fullscreen-btn {
background-color: #008CBA;
color: white;
font-size: 18px;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}

.fullscreen-btn:hover {
background-color: #004C8C;
}

.preview-container {
display: flex;
justify-content: center;
margin-top: 30px;
}

.preview-image {
width: 500px;
height: auto;
image-rendering: pixelated;
outline: 2px solid black;
}
</style>

<link rel="canonical" href="https://calculator.tools/app/pixel-fruit-generator-853/">
<meta charset="utf-8">

</head>
<body>
<h1>Pixelizar imagen</h1>
<div class="container">
<input type="file" id="image-input" accept="image/*">
<div class="controls">
<label for="pixel-size">Tamaño del pixel:</label>
<input type="number" id="pixel-size" class="control-input" min="1" value="10">
<label for="image-size">Tamaño de la imagen:</label>
<input type="number" id="image-size" class="control-input" min="100" value="500">
</div>
<button class="pixelate-btn" onclick="pixelateImage()">Pixelizar</button>
<button class="fullscreen-btn" onclick="openFullscreen()">Pantalla completa</button>
<a id="download-link" href="#" download="pixelated_image.png" style="display: none;">Descargar</a>
</div>
<div class="image-container">
<canvas id="pixelated-canvas"></canvas>
</div>
<div class="preview-container">
<img id="preview-image" class="preview-image" src="" alt="Vista previa">
</div>

<script>
function pixelateImage() {
const imageInput = document.getElementById('image-input');
const pixelatedCanvas = document.getElementById('pixelated-canvas');
const downloadLink = document.getElementById('download-link');
const previewImage = document.getElementById('preview-image');

const file = imageInput.files[0];
const reader = new FileReader();

reader.onload = function(event) {
const image = new Image();
image.onload = function() {
const pixelSize = parseInt(document.getElementById('pixel-size').value);
const imageSize = parseInt(document.getElementById('image-size').value);

const width = image.width;
const height = image.height;
const ratio = width / height;
let canvasWidth, canvasHeight;

if (width > height) {
canvasWidth = imageSize;
canvasHeight = imageSize / ratio;
} else {
canvasHeight = imageSize;
canvasWidth = imageSize * ratio;
}

pixelatedCanvas.width = canvasWidth;
pixelatedCanvas.height = canvasHeight;

const context = pixelatedCanvas.getContext('2d');
context.drawImage(image, 0, 0, canvasWidth, canvasHeight);
context.mozImageSmoothingEnabled = false;
context.webkitImageSmoothingEnabled = false;
context.imageSmoothingEnabled = false;
context.drawImage(pixelatedCanvas, 0, 0, canvasWidth, canvasHeight, 0, 0, canvasWidth / pixelSize, canvasHeight / pixelSize);

const dataURL = pixelatedCanvas.toDataURL();
downloadLink.href = dataURL;
downloadLink.style.display = 'inline-block';

previewImage.src = dataURL;
};

image.src = event.target.result;
};

reader.readAsDataURL(file);
}

function openFullscreen() {
const previewImage = document.getElementById('preview-image');

if (previewImage.requestFullscreen) {
previewImage.requestFullscreen();
} else if (previewImage.mozRequestFullScreen) { // Firefox
previewImage.mozRequestFullScreen();
} else if (previewImage.webkitRequestFullscreen) { // Chrome, Safari and Opera
previewImage.webkitRequestFullscreen();
} else if (previewImage.msRequestFullscreen) { // IE/Edge
previewImage.msRequestFullscreen();
}
}
</script>
<script type="text/javascript"> var localStoragePrefix = "ct-853"; 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.