Pass image to custom component

Hi everyone,
I’m creating a custom component using react. And I want to pass image from python to component (react). I checked if there is a way but could not find it.
Then I checked the source code of another community component streamlit-drawable-canvas that can pass image to component. And I found that actually they are converting image to numpy array and then passing that array.
But this method looks difficult. Is there a better way to pass image? If not than consider using streamlit-drawable-canvas method how can I convert that array to image in the frontend?