TensorBoard's built-in image summary API (tf.summary.image) expects image data as raw tensors (usually uint8 or float32 arrays), not compressed JPEG files directly. However, you can still display JPEG images in TensorBoard by:
1. Decoding JPEG images before logging
You can load and decode JPEG images from disk into tensors, then log them with tf.summary.image. For example:
import tensorflow as tf
def load_jpeg_as_tensor(path):
image_bytes = tf.io.read_file(path)
image = tf.image.decode_jpeg(image_bytes, channels=3)
image = tf.expand_dims(image, 0) # Add batch dimension
return image
image_tensor = load_jpeg_as_tensor('path/to/image.jpg')
with tf.summary.create_file_writer('logs').as_default():
tf.summary.image("My JPEG Image", image_tensor, step=0)
This way, you read the compressed JPEG file, decode it into a tensor, and then log it.
2. Linking to images on disk (not directly supported)
TensorBoard does not support linking to external images on disk or URLs directly in the image dashboard. The images must be embedded in the event logs as tensors.
3. Alternative: Use Markdown plugin or custom HTML
If you want to display images by URL or from disk without embedding them as tensors, you could:
- Use the TensorBoard Text or Markdown plugin to embed HTML
<img> tags pointing to accessible URLs (e.g., if you serve images via a web server).
- This requires the images to be accessible via HTTP(S) URLs, not local file paths.
Example markdown snippet:

Log this markdown text with tf.summary.text or tf.summary.markdown (depending on TensorBoard version).
Summary
- Direct JPEG input: No, you must decode JPEGs into tensors first.
- Link to images on disk: No direct support; images must be embedded.
- Workaround: Decode JPEGs or use Markdown plugin with URLs.
If you want, I can help you with a code snippet for any of these approaches!