img_to_solid
Creates a solid relief structure by extruding an image.
Signatures
- img_to_solid( image img )
- img_to_solid( image img, float scale, float minbase )
- img_to_solid( image img, float scale, float minbase, color sublayer )
Details
The function extrudes the gray scale of the image pixel colors a solid relief object. A gray scale of the form sqrt( r² + g² + b² ) is applied to interprete the image as height map.
Example
make img_to_solid( image( "australia.jpg" ), 15.0, 25.0 )
The scaling can be in positive direction (i.e. creation of elevated regions) or negativ (creation of depressions).
A minimum thickness of the base plate can be given via the minbase parameter. If the scaling is positive this means that this is exactly the base plate thickness below a black pixel. If the scaling is negative, this is the thickness under the brightest pixel of the image.
Note
The current version of img_to_solid() does not support the usage of image files with active alpha channel (i.e. images containing transparency) in combination with one of the first two constructors. Images with transparency require to provide a sublayer parameter (e.g. rgb(0,0,0)).
Return value
A solid that is the extruded version of the image.
Parameters
- img
-
The image that is extruded.
- scale
-
Defines how far a fully white pixel is extruded. If this value is positive, bright areas are elevated, if it is negative, bright areas are sunk-in. Default value is 1.0.
- minbase
-
Minimum thickness of the plate. This value should be larger than 0.0. Default value is 1.0.
- sublayer
-
If this parameter is given, pixels with partial or full transparency are interpreted as if blended with an opaque sublayer of this color.