Byte array of an image

How to send Byte array of an image from the custom action as a response ?

	with open("C:/Downloads/myimage.jpeg", "rb") as image:
		f =
		b = bytearray(f)
    image =
    dispatcher.utter_template("utter_thanks", tracker, False, image=image )

I got TypeError: Object of type JpegImageFile is not JSON serializable. Is there any solution.

Please respond any one

Can you instead use the filepath to the image, i.e. file:///C:\Downloads\myimage.jpeg">? I don’t believe there is a way to send a byte array of an image at the moment.

Hi @erohmensing, But our requirement is depending on Byte array

I think this would have to be handled by your output channel. So you would e.g. convert your bytes to a string to get them to the output channel, and then do something with that string in your output channel, depending on how your channel accepts the byte formatted request. This might be helpful: python - How to convert image data so it can be JSON serializable and vice versa - Stack Overflow. I don’t think that any of our current output channels support this.

Thanks @erohmensing, Recently I have posted some other issues. Please respond.