Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Create an image by tessellating many copies of a source image into a template
ResourceFunction["TessellateGraphics"][graphic,mask] creates an image using many copies of graphic placed using the binary image mask as a guide. |
"MinInsetSize” | 4 | the smallest size of inset image measured in template image pixels |
"Mask" | Automatic | the shape to eliminate from the template |
"MaskScaling" | 1 | the magnification of the mask to eliminate from the template |
"InsetScaling" | 0.98 | the magnification of the inset image to place in the output |
"MaxIterations" | 6 | the number of times to search for remaining space to insert images |
Create an image of a car using disks:
In[1]:= |
|
Out[1]= |
|
The inset contents can be a Wolfram Language Image, Graphics or Graphics3D:
In[2]:= |
|
Out[2]= |
|
In[3]:= |
|
Out[3]= |
|
In[4]:= |
|
Out[4]= |
|
If the inset graphics contain transparent contents, this may cause inset graphics within the inset graphics:
In[5]:= |
|
Out[5]= |
|
To prevent this, you can specify the option "Mask":
In[6]:= |
|
Out[6]= |
|
By default, the inset image is 2% smaller than the mask, leaving space around each image. Decreasing the value of "InsetScaling" will leave more space:
In[7]:= |
|
Out[7]= |
|
Increasing it will cause overlapping images:
In[8]:= |
|
Out[8]= |
|
TessellateGraphics recursively fills empty space with smaller inset images. You can control the number of iterations with the "MaxIterations" option. The smallest graphic to be inset is controlled by the "MinInsetSize" option, given in pixel sizes from the template image:
In[9]:= |
|
Out[9]= |
|
If the inset image has PlotRangePadding, ImagePadding or a PlotRange, it may not fill its bounding box:
In[10]:= |
|
Out[10]= |
|
You can compensate using "InsetScaling":
In[11]:= |
|
Out[11]= |
|
Images should have transparent backgrounds, otherwise overlapping image backgrounds will obscure contents:
In[12]:= |
|
Out[12]= |
|
This work is licensed under a Creative Commons Attribution 4.0 International License