Categories

Image Erode

Apply erosion morphological operation to shrink foreground objects in binary images

Click to upload file or drag and drop file here

Maximum file size: 10MB Supported formats: image/jpeg, image/png, image/webp, image/gif, image/bmp, image/tiff

Works best with binary (black and white) images

Number of times to apply erosion. More iterations = more shrinkage

Key Facts

Category
Design
Input Types
file, number
Output Type
file
Sample Coverage
4
API Ready
Yes

Overview

The Image Erode tool performs a morphological erosion operation to shrink foreground objects within binary images. By removing pixels from the boundaries of shapes, this utility helps isolate features, separate connected objects, or reduce noise in black-and-white image data.

When to Use

  • When you need to separate two objects that are touching or overlapping in a binary image.
  • When you want to remove small, unwanted noise or 'salt' pixels from a thresholded image.
  • When you need to reduce the size of foreground features to refine the precision of a shape or mask.

How It Works

  • Upload your binary (black and white) image file to the tool.
  • Set the number of iterations to define how aggressively the erosion should be applied.
  • Process the image to shrink the foreground objects based on your chosen settings.
  • Download the resulting image with the refined, reduced foreground shapes.

Use Cases

Refining masks for computer vision training datasets.
Cleaning up scanned documents or OCR inputs by removing stray noise.
Separating connected components in a binary map or layout diagram.

Examples

1. Separating Connected Text Characters

Data Entry Specialist
Background
A scanned document resulted in a binary image where some characters were touching due to low resolution.
Problem
The OCR software could not distinguish between connected letters.
How to Use
Upload the scanned binary image and set iterations to 1 to slightly shrink the character strokes.
Example Config
iterations: 1
Outcome
The characters are successfully separated, allowing the OCR software to read the text accurately.

2. Removing Noise from Binary Masks

Image Processing Researcher
Background
A segmentation mask contained small, isolated white pixels (noise) that interfered with object detection.
Problem
The noise pixels were causing false positives in the detection algorithm.
How to Use
Upload the mask and apply 2 iterations of erosion to eliminate the small noise clusters.
Example Config
iterations: 2
Outcome
The small noise pixels are completely removed, leaving only the primary objects in the mask.

Try with Samples

image, png, jpg

Related Hubs

FAQ

What is image erosion?

Erosion is a morphological operation that shrinks the white foreground areas of a binary image by removing pixels from their boundaries.

Does this tool work on color images?

It is designed for binary images. If you upload a color image, it may not produce the expected morphological results.

What do the iterations represent?

Iterations determine how many times the erosion process is repeated; higher values result in more significant shrinkage of the foreground objects.

What file formats are supported?

The tool supports common formats including JPEG, PNG, WebP, GIF, BMP, and TIFF.

Can I increase the size of objects instead?

No, this tool specifically performs erosion (shrinking). To increase object size, you would need a dilation tool.

API Documentation

Request Endpoint

POST /en/api/tools/image-erode

Request Parameters

Parameter Name Type Required Description
imageFile file (Upload required) Yes Works best with binary (black and white) images
iterations number No Number of times to apply erosion. More iterations = more shrinkage

File type parameters need to be uploaded first via POST /upload/image-erode to get filePath, then pass filePath to the corresponding file field.

Response Format

{
  "filePath": "/public/processing/randomid.ext",
  "fileName": "output.ext",
  "contentType": "application/octet-stream",
  "size": 1024,
  "metadata": {
    "key": "value"
  },
  "error": "Error message (optional)",
  "message": "Notification message (optional)"
}
File: File

AI MCP Documentation

Add this tool to your MCP server configuration:

{
  "mcpServers": {
    "elysiatools-image-erode": {
      "name": "image-erode",
      "description": "Apply erosion morphological operation to shrink foreground objects in binary images",
      "baseUrl": "https://elysiatools.com/mcp/sse?toolId=image-erode",
      "command": "",
      "args": [],
      "env": {},
      "isActive": true,
      "type": "sse"
    }
  }
}

You can chain multiple tools, e.g.: `https://elysiatools.com/mcp/sse?toolId=png-to-webp,jpg-to-webp,gif-to-webp`, max 20 tools.

Supports URL file links or Base64 encoding for file parameters.

If you encounter any issues, please contact us at [email protected]