Radial Gradient Image Generator
by mst8k in Craft > Digital Graphics
288 Views, 3 Favorites, 0 Comments
Radial Gradient Image Generator
Create beautiful, custom radial gradient images with your own color palettes, perfect for high-resolution graphics and backgrounds for hourly and annual clock faces. This step-by-step guide will walk you through the process of generating these images using Python, with options for adding cutout guides for easy post-production.
Follow along to create your own vibrant and artistic prints, or download pre-generated samples below!
Supplies
Free Software and Libraries
- Python 3.6+
- NumPy
- Matplotlib
- Pillow
Script
- Download the latest script and samples images from GitHub https://github.com/MST8K-code/Radial-Gradient-O-Matic/releases
Hardware (Optional)
- Printer for printing your generated images
- Scissors and/or a craft knife for cutting out the circular images
Install Python and Required Libraries
- Download and install Python from the official website: python.org.
- Install the required libraries by running the following commands in your terminal or command prompt:
pip install numpy matplotlib pillow
Download the Repository
- Download the latest script and samples images from GitHub https://github.com/MST8K-code/Radial-Gradient-O-Matic/releases
- Expand the compressed file into a new folder and then edit and run the script as desired.
Update Color Palettes
Open the Radial-Gradient-O-Matic.py script in a text editor and update the color_palettes dictionary to define your custom color palettes. Set the export field to True for the palettes you want to export.
By default the colors are distributed evenly around the circle. If you would like to do a custom gradient, add the degree value to each color. See the example below for the google_brand gradient. 0 degrees is at the 12-o'clock position in your graphic.
color_palettes = {
'bright_rainbow': {
'description': 'A bright and vibrant set of rainbow colors',
'export': True,
'colors': [
{'name': 'Yellow', 'color': '#eedd00'},
{'name': 'Orange', 'color': '#ee9944'},
{'name': 'Pink', 'color': '#c53f65'},
{'name': 'Lavender', 'color': '#8346c1'},
{'name': 'Blue', 'color': '#3366bb'},
{'name': 'Sky Blue', 'color': '#0099cc'},
{'name': 'Cyan', 'color': '#22ccbb'},
{'name': 'Green', 'color': '#99dd55'}
]
},
'google_brand': {
'description': 'Google brand colors',
'export': True,
'colors': [
{'name': 'Yellow', 'color': '#FBBC05', 'degree': 0},
{'name': 'Red', 'color': '#EA4335', 'degree': 180},
{'name': 'Blue', 'color': '#4285F4', 'degree': 270},
{'name': 'Green', 'color': '#34A853', 'degree': 315}
]
}
}
Adjust Script Constants
Customize the constants in the script to fit your needs. This includes the image resolution, print size, cutout ring properties, and more.
Example Constants
# Image Constants
outputSize = 6000 # Resolution in pixels
numSubdivisions = 30 # Number of divisions between each color change
gaussianBlurRadius = 50 # Radius for Gaussian blur
# Print Constants
printSize = 8 # Export print size in inches
printResolution = 350 # Resolution in DPI
cutoutThickness = 7 # Thickness of the cutout ring in pixels
cutoutColor = (0, 0, 0) # Color of the cutout ring
inner_cutout_width_in = 0.25 # Inner cutout diameter in inches
Run the Script
Execute the script to generate the images and settings files. The files will be saved in the same directory with timestamped filenames.
python generate_radial_gradient.py
Print and Cut Out Your Images
- Print the images using a high-resolution printer.
- Cut out the circular images using scissors or a craft knife along the outer cutout ring. Use the inner cutout ring as a guide if needed.
Download - Smooth Gradations
Settings
- Segments: 30
- Gaussian: 50