Return actual image data as workflow response
I am in need of a workflow that is able to return actual images when called via a HTTPS call. I can't figure out how I can return an actual image as the response of such a workflow. Is there anyone that can point me in the right direction?
3 Replies
Processing...
🤖 Engaging cognitive circuits. 💡 this might take a couple of minutes... beep boop
🤖 AI Response
To return an actual image (not just a URL) in a BuildShip workflow, configure your Return Node with the correct Content-Type header (such as image/jpeg or image/png) and set the response body to the binary data of the image, either by retrieving it from BuildShip Storage or decoding a Base64 string from an image generation node. This approach ensures the API response delivers the image directly, not just a link, and is compatible with both stored and dynamically generated images. If you need to generate the image (e.g., using AI nodes like Flux), ensure you decode the Base64 output before returning it as binary data with the appropriate headers.
🔗 References:
1. https://buildship.com/blog/object-detection-with-buildship-s-google-vision-api-template
2. https://buildship.com/blog/flux-ai-image-generation
3. https://buildship.com/blog/build-a-multimodal-ai-chatbot
4. https://www.youtube.com/watch?v=zW2boQQvLM8
5. https://www.youtube.com/watch?v=QHd2p0LVK1o
BuildShip AI Support
How do I set the content-type header to image/jpeg though? Can't seem to figure that one out