Please bookmark this page to avoid losing your image tool!

Image Color Channel Inspector

(Free & Supports Bulk Upload)

Drag & drop your images here or

The result will appear here...
You can edit the below JavaScript code to customize the image tool.
/**
 * Creates a visual representation of an image, showing only the selected color channels.
 *
 * @param {HTMLImageElement} originalImg - The source image object.
 * @param {number | string} showR - Set to 1 to show the Red channel, 0 to hide. Defaults to 1.
 * @param {number | string} showG - Set to 1 to show the Green channel, 0 to hide. Defaults to 1.
 * @param {number | string} showB - Set to 1 to show the Blue channel, 0 to hide. Defaults to 1.
 * @param {number | string} showA - Set to 1 to show the Alpha channel, 0 to hide. Defaults to 1.
 * @returns {HTMLCanvasElement} A canvas element with the processed image.
 */
function processImage(originalImg, showR = 1, showG = 1, showB = 1, showA = 1) {
  const canvas = document.createElement('canvas');
  const ctx = canvas.getContext('2d');

  const imgWidth = originalImg.naturalWidth || originalImg.width;
  const imgHeight = originalImg.naturalHeight || originalImg.height;

  canvas.width = imgWidth;
  canvas.height = imgHeight;

  try {
    // Draw the image to the canvas
    ctx.drawImage(originalImg, 0, 0, imgWidth, imgHeight);

    // Get the pixel data from the canvas
    const imageData = ctx.getImageData(0, 0, imgWidth, imgHeight);
    const data = imageData.data;

    // Coerce parameters to boolean-like flags for easier checking
    const displayR = Number(showR) !== 0;
    const displayG = Number(showG) !== 0;
    const displayB = Number(showB) !== 0;
    const displayA = Number(showA) !== 0;

    // Special case: If only the alpha channel is selected, display it as a grayscale image
    const onlyShowA = !displayR && !displayG && !displayB && displayA;

    // Iterate over each pixel (4 bytes: R, G, B, A)
    for (let i = 0; i < data.length; i += 4) {
      if (onlyShowA) {
        const alpha = data[i + 3];
        // Set R, G, and B channels to the alpha value to create a grayscale representation
        data[i] = alpha;     // Red
        data[i + 1] = alpha; // Green
        data[i + 2] = alpha; // Blue
        data[i + 3] = 255;   // Make it fully opaque to see the result clearly
      } else {
        // Otherwise, mute the channels that are not selected
        if (!displayR) data[i] = 0;
        if (!displayG) data[i + 1] = 0;
        if (!displayB) data[i + 2] = 0;
        // If alpha is not displayed, make the pixel fully opaque to avoid confusion
        if (!displayA) data[i + 3] = 255;
      }
    }

    // Put the modified pixel data back onto the canvas
    ctx.putImageData(imageData, 0, 0);

  } catch (e) {
    // Handle potential CORS issues when using getImageData with cross-origin images
    console.error("Could not process image due to cross-origin restrictions:", e);
    ctx.font = "16px sans-serif";
    ctx.fillStyle = "red";
    ctx.textAlign = "center";
    ctx.textBaseline = "middle";
    const message = "Cannot process cross-origin image.";
    ctx.fillText(message, canvas.width / 2, canvas.height / 2);
  }

  return canvas;
}

Free Image Tool Creator

Can't find the image tool you're looking for?
Create one based on your own needs now!

Description

The Image Color Channel Inspector is a web-based tool that allows users to visualize and analyze individual color channels of an image, such as Red, Green, Blue, and Alpha. Users can selectively display or hide these channels, making it a valuable resource for graphic designers, photographers, and developers who want to understand the composition of an image or diagnose color-related issues. The tool can be utilized for educational purposes, analyzing the effects of each color channel on overall image quality, and for creative expression in digital art.

Leave a Reply

Your email address will not be published. Required fields are marked *

Other Image Tools:

Image Text Overlay Creator

Comprehensive Image Utility Tool

Image To 2000s Low Quality Digital Camera Effect Tool

Image Headshot Cropper with 1:1 Resolution

Image AI Filter Effect Remover

Image Gloomy Effect Editor

Image Japanese Anime-Style Generator

3D Cartoon Style Image Creator

Image To Pixel-Style Converter

Image Black And White HUD Style With VHS Effects

Black and White MQ1 Reaper Drone Targeting Pod Image

Image Filter for MQ1 Reaper Drone Targeting Pod

Image Hyper-Realistic Portrait Triptych Generator

Image To Professional Architectural Render Blueprint Converter

Image Ultraviolet Camera Filter

Image Portrait Generator with Warm Golden Hour Lighting

Image Softly Lit Portrait Generator

Image Petal Count Identifier

Image Ball Creator

Image To CAD-Style Blueprint Converter

Image To Blueprint CAD Style Converter

Image To Clean CAD Blueprint Generator

Image To CAD Blueprint Generator

Image To Technical Blueprint Style Converter

Image To Blueprint-Style Drawing Converter

Image To Technical Blueprint Converter

Architectural Plan to Technical Blueprint Image Converter

Architectural Plan To Blueprint-Style Image Converter

Image To Blueprint Architectural Style Converter

Image Background Replacement To White

Image To Dot Outline Converter

Image To Vertical Halftone Converter

Image Transparent Hologram Effect Generator

Image Blue Twilight Filter Applicator

Image Golden Ratio Spiral Generator for A4

Photo Black and White Floyd-Steinberg Dithering for Acrylic Engraving

See All →