Skip to content
Draft
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
4 changes: 2 additions & 2 deletions rosboard/compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ def compress_compressed_image(msg, output):
stride = int(np.ceil(max(img.shape[0] / 800.0, img.shape[1] / 800.0)))
img = img[::stride,::stride]
img_jpeg = encode_jpeg(img)
output["_data_jpeg"] = base64.b64encode(img_jpeg).decode()
output["_data_shape"] = list(original_shape)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An exception was caught during testing and I found this issue; either the Exception handler should return or the lines should be added to the try block. I chose the latter option.

except Exception as e:
output["_error"] = "Error: %s" % str(e)
output["_data_jpeg"] = base64.b64encode(img_jpeg).decode()
output["_data_shape"] = list(original_shape)


def compress_image(msg, output):
Expand Down