Hi
I’m working on a project where my Arduino sketch sends HTML content over the serial monitor (for example, using Serial.println() to simulate a basic web interface). Everything works fine for displaying text and buttons, but I can’t seem to get any images to show up in the browser when I open the serial output in a tool that parses it.
Here’s a simplified version of what my sketch is doing:
Serial.println("<html>");
Serial.println("<head><title>Test Page</title></head>");
Serial.println("<body>");
Serial.println("<h1>Welcome</h1>");
Serial.println("<img src='logo.png' alt='Logo'>");
Serial.println("</body>");
Serial.println("</html>");
What’s going wrong:
- The image doesn't appear in the browser.
- Instead, I see a broken image icon or nothing at all.
- This happens with both local paths like
logo.pngand full URLs likehttps://example.com/image.jpg.
What I’ve tried:
- Verified the image file exists and works when opened directly in the browser.
- Tried using full URLs instead of local files — same result.
- Changed
imgtag formatting (e.g., self-closing tag, adding width/height). - Tried different browsers.
- Ensured that
Content-Type: text/htmlis set (in tools that accept HTTP headers).
My questions:
- Is it even possible to render images this way via Serial output, or am I misunderstanding how the browser interprets this content?
- Do I need to encode the image as base64 and send it inline instead?
- Would switching to a proper web server approach (e.g., ESP32/ESP8266 hosted page) be the right solution if I want full HTML rendering with images?