ShinyLEGO: Create LEGO mosaics directly from R and Shiny

ShinyLEGO is a Shiny application that lets you create a simulated mosaic composed of LEGO bricks from any image file. Once your picture is uploaded, you can customize various settings for your mosaic such as dimensions, brightness, and color types. In addition, the application will generate specific instructions so that you can build the mosaic yourself! These instructions contain the brick colors and types required for each step, and a diagram showing how the bricks are to be assembled.

This application would not be possible without the innovative R scripts created by Ryan Timpe! Ryan has written excellent blogposts detailing the workflow this application draws upon, and the code for each post can be found on his LEGOMosaics GitHub repository:


You can install the development version of shinylego from GitHub with:

# install.packages("remotes")


Once you have installed the package, you can run the application within your R session using the following command:



shinylego is also available on the hosting service at

Note for developer: The deployment should not include files associated with renv, since the service will handle package versions during the deployment process. Add the files/directories required for deployment in the dev/app_manifest.txt file, and execute deployment with the following:

rsconnect::deployApp(appName = "shinylego", appFileManifest = "dev/app_manifest.txt", launch.browser = FALSE)


Contributions are welcome! This application uses the renv package to manage the versions of dependencies. After cloning the repository, launch a new session in the repository root directory and execute renv::restore() to download the package library.


In addition to Ryan Timpe’s excellent R programs detailed above, this application utilizes many powerful packages in the shiny ecosystem such as the following:


Please note that the ‘shinylego’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

rpodcast/shinylego documentation built on Oct. 1, 2021, 6:37 a.m.