Files
Blogv3/public/posts/pasar-imagenes-a-blanco-y-negro/index.html
T
2026-11-25 16:21:26 -03:00

250 lines
12 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="es" class="dark">
<head><script src="/livereload.js?mindelay=10&amp;v=2&amp;port=1313&amp;path=livereload" data-no-instant defer></script>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="color-scheme" content="dark" />
<title>Imagenes: Color a b&amp;w · Blog Fede</title>
<link rel="stylesheet" href="/css/compiled.min.713ddb4e4075038ead66848b5e80d247495f1f51729620bddcd1f613da197bb0.css" integrity="sha256-cT3bTkB1A46tZoSLXoDSR0lfH1FyliC93NH2E9oZe7A=">
<script src="/js/health.min.c40e1d74909dc0088b83a542798ddd91ad1562ae7755a2f27df04d77448fba9b.js" integrity="sha256-xA4ddJCdwAiLg6VCeY3dka0VYq53VaLyffBNd0SPups=" defer></script>
</head>
<body class="bg-[#11111b] text-[#cdd6f4] min-h-screen antialiased font-mono selection:bg-[#cba6f7]/40 selection:text-[#11111b] overflow-x-hidden">
<canvas id="matrix-bg" class="fixed inset-0 h-full w-full bg-[#11111b]" aria-hidden="true"></canvas>
<div id="matrix-spotlight" class="pointer-events-none fixed inset-0" aria-hidden="true"></div>
<div class="pointer-events-none fixed inset-0 bg-[radial-gradient(ellipse_at_center,transparent_0%,rgba(17,17,27,0.6)_100%)]" aria-hidden="true"></div>
<script>
(function () {
const canvas = document.getElementById("matrix-bg");
const spotlight = document.getElementById("matrix-spotlight");
if (!canvas) return;
const ctx = canvas.getContext("2d");
const C = {
base: "#11111b",
lavender: [180, 190, 254],
mauve: [203, 166, 247],
pink: [245, 194, 231],
rosewater: [245, 224, 220],
};
const GAP = 28;
const RADIUS = 240;
let cols = 0, rows = 0;
let mx = window.innerWidth / 2;
let my = window.innerHeight / 3;
let hasMouse = false;
function resize() {
const dpr = Math.min(window.devicePixelRatio || 1, 2);
canvas.width = Math.floor(window.innerWidth * dpr);
canvas.height = Math.floor(window.innerHeight * dpr);
canvas.style.width = window.innerWidth + "px";
canvas.style.height = window.innerHeight + "px";
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
cols = Math.ceil(window.innerWidth / GAP);
rows = Math.ceil(window.innerHeight / GAP);
}
function setSpotlight(x, y) {
spotlight.style.background =
"radial-gradient(circle " + RADIUS + "px at " + x + "px " + y + "px, " +
"rgba(203,166,247,0.13) 0%, rgba(180,190,254,0.05) 45%, transparent 70%)";
}
setSpotlight(mx, my);
window.addEventListener("resize", resize);
window.addEventListener("pointermove", (e) => {
mx = e.clientX;
my = e.clientY;
hasMouse = true;
setSpotlight(mx, my);
}, { passive: true });
document.addEventListener("pointerleave", () => { hasMouse = false; });
resize();
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
function mix(a, b, t) {
return [
Math.round(a[0] + (b[0] - a[0]) * t),
Math.round(a[1] + (b[1] - a[1]) * t),
Math.round(a[2] + (b[2] - a[2]) * t),
];
}
function frame(t) {
requestAnimationFrame(frame);
if (reduceMotion) t = 0;
const W = window.innerWidth;
const H = window.innerHeight;
ctx.shadowBlur = 0;
ctx.fillStyle = C.base;
ctx.fillRect(0, 0, W, H);
for (let j = 0; j < rows; j++) {
const y = j * GAP + GAP / 2;
for (let i = 0; i < cols; i++) {
const x = i * GAP + GAP / 2;
const dx = x - mx;
const dy = y - my;
const dist = hasMouse ? Math.sqrt(dx * dx + dy * dy) : 9999;
let f = Math.max(0, 1 - dist / RADIUS);
f = f * f * (3 - 2 * f);
const tw = reduceMotion ? 0.5 : 0.5 + 0.5 * Math.sin(t * 0.001 + (x + y) * 0.02);
if (f > 0.01) {
const c = f > 0.65 ? mix(C.mauve, C.rosewater, (f - 0.65) / 0.35)
: f > 0.3 ? mix(C.lavender, C.mauve, (f - 0.3) / 0.35)
: mix([88, 91, 112], C.lavender, f / 0.3);
const r = 1.2 + f * 1.2;
ctx.shadowBlur = 16 * f;
ctx.shadowColor = "rgba(203,166,247,0.9)";
ctx.fillStyle = "rgba(" + c[0] + "," + c[1] + "," + c[2] + "," + (0.35 + f * 0.65).toFixed(2) + ")";
ctx.beginPath();
ctx.arc(x, y, r, 0, Math.PI * 2);
ctx.fill();
} else {
ctx.shadowBlur = 0;
ctx.fillStyle = "rgba(88,91,112," + (0.16 + tw * 0.14).toFixed(2) + ")";
ctx.beginPath();
ctx.arc(x, y, 1.2, 0, Math.PI * 2);
ctx.fill();
}
}
}
ctx.shadowBlur = 0;
}
requestAnimationFrame(frame);
})();
</script>
<div class="relative z-10 flex min-h-screen flex-col">
<main class="flex-1 w-full">
<nav class="fixed inset-x-0 top-0 z-20 border-b-2 border-[#cdd6f4] bg-[#181825]">
<div class="mx-auto flex h-16 max-w-6xl items-center justify-between px-4 sm:px-6">
<a href="/" class="border-2 border-[#cdd6f4] bg-[#cba6f7] px-2 py-1 font-mono text-sm font-black tracking-tight text-[#11111b] uppercase shadow-[3px_3px_0_#f5c2e7] transition hover:translate-x-[1px] hover:translate-y-[1px] hover:shadow-[1px_1px_0_#f5c2e7]">
~/fedesrv<span class="ml-1 inline-block h-4 w-2 animate-pulse bg-[#11111b] align-middle"></span>
</a>
<div class="hidden items-center gap-2 md:flex">
<a href="/git" target="_blank" class="border-2 border-transparent px-3 py-1 text-sm font-bold text-[#a6adc8] transition hover:border-[#cdd6f4] hover:bg-[#cba6f7] hover:text-[#11111b] hover:shadow-[3px_3px_0_#f5c2e7]">Git</a>
<a href="https://fedesrv.ddns.net/git/fede/CV/media/branch/master/Federico_Polidoro_CV.pdf" target="_blank" class="border-2 border-transparent px-3 py-1 text-sm font-bold text-[#a6adc8] transition hover:border-[#cdd6f4] hover:bg-[#cba6f7] hover:text-[#11111b] hover:shadow-[3px_3px_0_#f5c2e7]">CV</a>
<a href="https://github.com/fedpo2" target="_blank" class="border-2 border-transparent px-3 py-1 text-sm font-bold text-[#a6adc8] transition hover:border-[#cdd6f4] hover:bg-[#cba6f7] hover:text-[#11111b] hover:shadow-[3px_3px_0_#f5c2e7]">GitHub</a>
<a href="mailto:federico.nicolas.polidoro@gmail.com" target="_blank" class="border-2 border-transparent px-3 py-1 text-sm font-bold text-[#a6adc8] transition hover:border-[#cdd6f4] hover:bg-[#cba6f7] hover:text-[#11111b] hover:shadow-[3px_3px_0_#f5c2e7]">Email</a>
<a href="https://www.linkedin.com/in/federico-polidoro-40137a25b/" target="_blank" class="border-2 border-transparent px-3 py-1 text-sm font-bold text-[#a6adc8] transition hover:border-[#cdd6f4] hover:bg-[#cba6f7] hover:text-[#11111b] hover:shadow-[3px_3px_0_#f5c2e7]">LinkedIn</a>
</div>
<div class="md:hidden">
<button onclick="toggleOffCanvas()" aria-label="Abrir menú" class="border-2 border-[#cdd6f4] bg-[#cba6f7] px-2 py-1 text-[#11111b] shadow-[3px_3px_0_#f5c2e7] transition hover:translate-x-[1px] hover:translate-y-[1px] hover:shadow-[1px_1px_0_#f5c2e7]">
<svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2.5">
<path stroke-linecap="square" stroke-linejoin="miter" d="M4 6h16M4 12h16M4 18h16" />
</svg>
</button>
</div>
</div>
<div id="offCanvas" class="fixed top-16 right-0 h-screen w-64 translate-x-full border-l-2 border-[#cdd6f4] bg-[#181825] transition-transform duration-200 ease-in-out">
<div class="flex flex-col gap-2 p-4 font-mono text-sm font-bold">
<a href="/git" target="_blank" class="border-2 border-[#cdd6f4] bg-[#1e1e2e] px-3 py-2 text-[#cdd6f4] shadow-[3px_3px_0_#cba6f7] hover:bg-[#cba6f7] hover:text-[#11111b]">Git</a>
<a href="https://fedesrv.ddns.net/git/fede/CV/media/branch/master/Federico_Polidoro_CV.pdf" target="_blank" class="border-2 border-[#cdd6f4] bg-[#1e1e2e] px-3 py-2 text-[#cdd6f4] shadow-[3px_3px_0_#cba6f7] hover:bg-[#cba6f7] hover:text-[#11111b]">CV</a>
<a href="https://github.com/fedpo2" target="_blank" class="border-2 border-[#cdd6f4] bg-[#1e1e2e] px-3 py-2 text-[#cdd6f4] shadow-[3px_3px_0_#cba6f7] hover:bg-[#cba6f7] hover:text-[#11111b]">GitHub</a>
<a href="mailto:federico.nicolas.polidoro@gmail.com" target="_blank" class="border-2 border-[#cdd6f4] bg-[#1e1e2e] px-3 py-2 text-[#cdd6f4] shadow-[3px_3px_0_#cba6f7] hover:bg-[#cba6f7] hover:text-[#11111b]">Email</a>
<a href="https://www.linkedin.com/in/federico-polidoro-40137a25b/" target="_blank" class="border-2 border-[#cdd6f4] bg-[#1e1e2e] px-3 py-2 text-[#cdd6f4] shadow-[3px_3px_0_#cba6f7] hover:bg-[#cba6f7] hover:text-[#11111b]">LinkedIn</a>
</div>
</div>
</nav>
<script>
function toggleOffCanvas() {
const offCanvas = document.getElementById("offCanvas");
offCanvas.classList.toggle("translate-x-full");
}
</script>
<div class="bg-blue-300 p-12"></div>
<div class="bg-blue-300">
<div class="bg-white rounded-md flex flex-col items-center px-2 py-6 max-w-4xl mx-auto">
<div class="w-full mb-8 overflow-hidden rounded-lg shadow-xl border-4 border-black">
<div class="bg-gray-200 text-gray-600 font-mono text-center py-16">
No image
</div>
</div>
<h1 class="text-4xl font-bold mb-4 text-center">Imagenes: Color a b&amp;w</h1>
<div class="text-sm text-gray-600 mb-6 font-mono flex gap-4 justify-center">
<span>Publicado el: Sep 23, 2023</span>
<div class="flex gap-2">
<span class="px-2 py-1 bg-gray-200 rounded-full">#old_blog</span>
</div>
</div>
<article>
<h1 id="gimp">Gimp</h1>
<p>Hay varias formas de pasar una imagen a blanco y negro. yo prefiero la de usar <strong>Gimp</strong> con la opcion de <code>Color &gt; Desaturacion &gt; Color a gama de grises</code>. Pero voy a listar un par de métodos alternativos para obtener el ~mismo resultado.<br>
<img src="/fedecomp.png" alt="Comparación"></p>
<h1 id="imagemagick">ImageMagick</h1>
<blockquote>
<p>Es un conjunto de utilidades de código abierto​ para mostrar, manipular y convertir imágenes, capaz de leer y escribir más de 200 formatos.​</p>
</blockquote>
<p>Una de esas utilidades es llamada <code>convert</code>, la cual acepta un archivo y convierte este a el formato que se le especifique. Existe una flag llamada <code>-colorspace</code> la cual si le damos el parametro <strong>Gray</strong> la imagen resultante estará representada en una gama de grises.
<img src="/fedeg.jpg" alt="Imagen en gama de grises"></p>
<h2 id="nota">Nota</h2>
<p>Tambien se puede usar la flag <code>-monocrome</code> pero esta da un resultado el cual no me termina de gustar, a continuacion doy un par de muestras de como queda,
<img src="/fedebw.jpg" alt="Imagen monocroma"></p>
<h1 id="opcion-web">Opcion web</h1>
<p>Existe <a href="https://pinetools.com/es/imagen-escala-grises">esta</a> pagina en la cual para generar la imagen en gama de grises solo hay que poner la imagen y darle a <strong>Aplicar</strong>.<br>
<img src="/gamaDeGrises.jpg" alt="Gama de grises demo"></p>
</article>
<a
href="/"
class="
inline-block mt-6
border-2 border-black bg-white px-6 py-2
shadow-[0_4px_0_black]
hover:shadow-[0_8px_0_black]
hover:-translate-y-1
transition-all duration-100 ease-linear
font-medium
"
>
← Volver
</a>
</div>
</div>
<div class="bg-blue-300 p-5"></div>
</main>
<footer class="border-t-2 border-[#cdd6f4] bg-[#181825] text-center text-xs font-bold text-white py-6">
<span class="inline-block border-2 border-[#cdd6f4] bg-[#1e1e2e] px-3 py-1 text-white shadow-[3px_3px_0_#cba6f7]">~ © 2026 Federico Polidoro <span class="text-white">·</span> sitemap</span>
</footer>
</div>
</body>
</html>