Please bookmark this page to avoid losing your image tool!

Image Transparency Viewer

(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 canvas that displays an image with a checkerboard background
 * to help visualize its transparent areas.
 *
 * @param {HTMLImageElement} originalImg The original image object to process.
 * @param {number} [squareSize=10] The size in pixels of each square in the checkerboard background.
 * @param {string} [color1='#ffffff'] The first color of the checkerboard pattern.
 * @param {string} [color2='#cccccc'] The second color of the checkerboard pattern.
 * @returns {HTMLCanvasElement} A new canvas element displaying the image with a transparency grid.
 */
function processImage(originalImg, squareSize = 10, color1 = '#ffffff', color2 = '#cccccc') {
  // Create a new canvas element
  const canvas = document.createElement('canvas');
  const ctx = canvas.getContext('2d');

  // Set the canvas dimensions to match the original image
  canvas.width = originalImg.naturalWidth;
  canvas.height = originalImg.naturalHeight;

  // Ensure squareSize is a positive number
  const size = Math.max(1, Number(squareSize));

  // Draw the checkerboard pattern
  for (let y = 0; y < canvas.height; y += size) {
    for (let x = 0; x < canvas.width; x += size) {
      // Determine which color to use based on the position of the square
      const isColor1 = (Math.floor(x / size) + Math.floor(y / size)) % 2 === 0;
      ctx.fillStyle = isColor1 ? color1 : color2;
      ctx.fillRect(x, y, size, size);
    }
  }

  // Draw the original image on top of the checkerboard background
  ctx.drawImage(originalImg, 0, 0);

  // Return the completed canvas
  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 Transparency Viewer is a tool designed to help users visualize transparent areas within images. By overlaying the original image on a checkerboard background, the tool makes it easy to identify which parts of the image are transparent, as they will be visible against the checkerboard pattern. This can be particularly useful for graphic designers, artists, and web developers who need to assess or refine images with transparency, such as PNG files. The tool allows for the adjustment of checkerboard square size and colors, providing flexibility in how the transparency is visualized.

Leave a Reply

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