Morse Code Image Decoder: Extract Morse from Images
Upload an image that contains dots and dashes. The decoder auto-detects the Morse strip, applies Otsu thresholding, filters noise, and translates the result into readable text. Supports both horizontal and vertical layouts.
Image Decoder
Upload an image of dots and dashes. The decoder auto-detects the Morse strip, applies Otsu thresholding, and translates the result.
Drop an image here or click to upload
PNG, JPG, GIF, WebP
Decode Settings
0 = auto (ratio-based)
How It Works
- 1.Upload an image containing dots and dashes (horizontal or vertical).
- 2.The decoder auto-finds the Morse strip by scanning for the row with the most transitions.
- 3.Otsu's method picks the optimal brightness threshold automatically.
- 4.Runs of dark pixels are classified as dots or dashes using ratio-based detection.
- 5.Gaps between runs are classified as symbol, letter, or word breaks.
How Image-Based Morse Decoding Works
Morse code was designed for human ears and eyes, not for computers. But the underlying structure (alternating runs of signal and silence) maps cleanly onto classic computer-vision techniques. The decoder follows a six-stage pipeline that auto-detects the Morse strip and adapts to the image.
Stage 1: Grayscale conversion. Each pixel's red, green, and blue values are combined into a single luminance number using the ITU-R BT.601 weighting (0.299R + 0.587G + 0.114B). This collapses a 3-channel color image into a single-channel intensity map.
Stage 2: Otsu thresholding. Instead of a fixed threshold, the decoder uses Otsu's method to automatically find the optimal brightness threshold that separates dark marks from light background. This adapts to each image's contrast level. You can override with a manual threshold if needed.
Stage 3: Strip detection. The decoder scans every row (or column for vertical Morse) and counts dark-to-light transitions. A sliding window finds the band with the most transitions, which is the Morse strip. This means the Morse code does not need to be vertically centered.
Stage 4: Noise filtering. Runs of dark pixels shorter than the min-dot threshold are filtered out as noise. This prevents tiny specks from being misread as dots.
Stage 5: Ratio-based classification. Each dark run is classified as a dot or a dash based on its length relative to the median run length. A dash is roughly 2x the median, a dot is shorter. This adapts to the image scale automatically, so you do not need to set fixed pixel thresholds.
Stage 6: Gap classification. Light gaps between dark runs are classified as symbol gaps (within a letter), letter gaps, or word gaps based on their width relative to the median gap. The decoder assembles the final Morse string, with single spaces between letters and “ / ” between words.
Tips for Best Results
High Contrast
Black marks on white paper, or white marks on black, work best. Avoid grayscale gradients or low-contrast photos.
Any Orientation
The decoder auto-detects the Morse strip and supports both horizontal and vertical layouts. Use the Orientation toggle to match your image.
Clear Gaps
Make sure letter gaps (3 dot widths) and word gaps (7 dot widths) are visible. Crowded marks with tiny gaps will merge into single letters.
Auto Threshold
Leave the threshold on Auto (Otsu) for most images. The decoder picks the optimal value automatically. Only switch to manual if the result looks wrong.
Image Decoder FAQ
How does the Morse code image decoder work?+
The tool loads your image onto an HTML canvas, converts each pixel to grayscale, applies a brightness threshold to mark pixels as dark or light, then scans the middle 5 rows of the image column by column. Runs of dark pixels become dots or dashes based on their width. Gaps between runs become symbol, letter, or word separators based on how wide they are.
What kind of images work best?+
Clean horizontal strips of dots and dashes with high contrast between the marks and the background. The image should be roughly horizontal, well-lit, and free of noise or text overlays. A photo of a printed Morse chart, a screenshot of a clean Morse display, or a hand-drawn strip on white paper all work well.
What do the threshold, min-dot, and min-dash sliders do?+
Threshold (0 to 255) sets the brightness cutoff; pixels darker than this are treated as part of a Morse mark. Min-dot (1 to 20px) is the smallest width that counts as a dot; anything smaller is treated as noise. Min-dash (5 to 100px) is the smallest width that counts as a dash, and anything between min-dot and min-dash is still a dot. Adjust these if you get too many or too few symbols.
When should I use the Invert toggle?+
Use Invert when your image has light marks on a dark background, like white dots on a black chart. By default the tool looks for dark marks on a light background. If your extraction looks reversed or empty, try toggling Invert.
What does LTR / RTL direction do?+
LTR (left to right) is the default; the tool reads the image from left to right. RTL (right to left) reverses the reading order, which helps if your image was photographed from the other side or mirrored. The reversal preserves word boundaries (the / separator).
Why is image-based Morse decoding considered experimental?+
Image processing is sensitive to lighting, contrast, rotation, noise, and font weight. Small changes can cause the threshold to misclassify pixels. The tool works well on clean, high-contrast images but will struggle with photos taken in poor lighting, hand-drawn Morse, or images with overlapping text. Always review the extracted Morse before trusting the translation.
More Morse Tools
Once you have decoded your image, try the audio engine to hear the result or the translator to type new messages.