Skip to content
This repository has been archived by the owner on Mar 25, 2020. It is now read-only.

make_image: reshape tensor for Grayscale image #59

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion python/tensorboard/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ def make_image(tensor):
"""Convert an numpy representation image to Image protobuf"""
from PIL import Image
height, width, channel = tensor.shape
image = Image.fromarray(tensor)
if channel == 1:
image = Image.fromarray(tensor.reshape(height, width))
else:
image = Image.fromarray(tensor)
import io
output = io.BytesIO()
image.save(output, format='PNG')
Expand Down