How do I upload an image from Grasshopper as a Blob?

I’m trying to support context imagery in a custom web viewer for Speckle. Since Speckle doesn’t currently support texture mapping (as far as I know), I’m hoping to upload an image alongside a Speckle geometry that I can then apply as a texture in a web viewer.

I saw this discussion around blob support for a similar use case, so I assume blobs are supported currently, but I can’t find any examples of their use with images.

What format does the image data need to be in so that we can connect it correctly via GH?

Thanks!

Hey @kgoulding!

@dimitrie or @gjedlicska may be able to give you a bit more detail on the API side but in essence:

The server was updated to be able to use blob storage but this hasn’t yet been translated into a way to send/receive images from connectors.

As far as I’m aware, Blob storage is only used for our file upload service to store the original files.

We don’t have an ETA for this… but maybe something for @Pavol to consider :slight_smile:

1 Like

Hey @kgoulding

A PR has been merged into speckle-sharp/core to add blob support. But that functionality has not been exposed to connectors or received the documentation love it deserves.

As an option B, you can use the server’s blob api to store blobs attached to the stream:

the ${serverUrl}/api/stream/{streamId}/blob endpoint support multipart/form-data with file uploads.
The response contains a blobId, which can be used to retreive the blob content via:

${serverUrl}/api/stream/{streamId}/blob/{blobId} in your custom web viewer.

Let me know if you have more questions,
Gergő

That sounds like exactly what we need. We’ll give it a go.

Thanks!

2 Likes