The Import Bitmap component is a way to let online users upload an image that can be used as an input to the Grasshopper definition. There are two ways to import an image using this component:
By giving a URL to the URI input parameter (possible locally in Grasshopper and in the online viewer)
By double-clicking on the button generated by the component, after the file is uploaded to the platform (possible only in the online viewer). The button opens a dialog allowing online users to upload their local files.
Let users set an image URL
You might want to give the possibility for users to enter a public URL where their images are stored instead of uploading local files. The Direct Text Input component can be connected to the URI input parameter as a way of dynamically changing the location/URL of the image which will be imported.
In Grasshopper, the component can only be tested using the option 1, both with public online URLs and with files stored locally (using the path of the file on the local machine).
The files must be hosted in a publicly accessible online location that allows downloading. Read more about how to store files online and use them in the ShapeDiver viewer.
Importing private files
ShapeDiver Enterprise customers are provided with a private and secure storage space that can be used to store external image files and use them with the ShapeDiver plugin. Learn more about the Enterprise plan here.
The component outputs a Grasshopper Bitmap object, as well as the width and height of the image.
Double-clicking on this component opens a dialog box with the options to set a maximum file size for the parameter and to enable different file types.
Set at least one file format
Make sure at least one file format is checked, otherwise online users will not be able to upload their files. By default, all file formats are checked.
Name of the file input
Once uploaded to ShapeDiver, the Import Image component will generate a button in the “Parameters” section of the model view page on the platform. Right-click on the component and give it a different nickname in order to change the label of the button on the ShapeDiver platform.
Supported file formats
The following image file formats are currently supported by the Import Image component:
bmp (MIME type: image/bmp)
gif (MIME type: image/gif)
jpeg (MIME type: image/jpeg)
png (MIME type: image/png)
tiff (MIME type: image/tiff)
Let us know through the forum if you need to import more image formats.