{
const height = 256;
const k = height / Math.max(...histogram);
const context = DOM.context2d(256, height, 1);
context.canvas.style.width = "100%";
context.canvas.style.height = `${height}px`;
context.canvas.style.imageRendering = "pixelated";
context.canvas.style.background = "#333";
context.canvas.style.borderBottom = "solid 1px #000";
context.globalCompositeOperation = "screen";
context.fillStyle = "#f00";
for (let i = 0; i < 256; ++i) {
context.fillRect(i, height - histogram[i * 3 + 0] * k, 1, height);
}
context.fillStyle = "#0f0";
for (let i = 0; i < 256; ++i) {
context.fillRect(i, height - histogram[i * 3 + 1] * k, 1, height);
}
context.fillStyle = "#00f";
for (let i = 0; i < 256; ++i) {
context.fillRect(i, height - histogram[i * 3 + 2] * k, 1, height);
}
return context.canvas;
}