Convert any picture into a Rubik's Cube-style mosaic, using only official Rubik cube colors (red, green, blue, white, yellow, orange). The script calculates how many cube pieces you need and the size of the frame.
rubic/
├── image_to_rubic.py
├── your_image.png
├── rubik_output.png # Output image (autogenerated)- Put your image in the same folder as the script.
- Open your terminal in that folder.
- Run the script with:
python image_to_rubic.py your_image.png 12000Where:
your_image.pngis your input image.12000is the number of Rubik cubes you want to use.
[✅] Rubik-style image saved as 'rubik_output.png'.
[📏] Required Rubik frame: 109x109 cubes
[📐] Total frame size: 218 cm x 218 cm- 🔴 Red
- 🟠 Orange
- 🟡 Yellow
- 🟢 Green
- 🔵 Blue
- ⚪ White
Make sure to install dependencies:
pip install pillow numpy- Each Rubik tile is 2 cm x 2 cm.
- Final frame size is calculated based on number of cubes per side.

