A Python script that generates high-quality, smooth horizontal gradients using linear interpolation. The script blends multiple RGB colors to create a 1920x1080 (HD) image, perfect for slide backgrounds or wallpapers.
- Customizable Colors: Easily modify the RGB values to create your own palette.
- High Definition: Generates a 1920x1080 image by default.
- Smooth Transitions: Uses mathematical linear interpolation to blend colors without banding.
You need Python 3 and the Pillow library installed.
pip install Pillow- Open the script in your code editor.
- Run the script via the command line:
python gradientBackground.py- The script will generate a file named
gradient_background.pngin the same directory.
To change the color palette, modify the colours list in the script. You can add or remove as many RGB tuples as you like.
colours = [
(71, 146, 207), # Blue
(255, 0, 0), # Red (Example change)
# Add more (R, G, B) tuples here...
]To change the output resolution, update the width and height variables:
width, height = 3840, 2160 # Example for 4KYou can modify the brightness_factor and contrast_factor variables in the script to adjust the output image's brightness and contrast.
brightness_factor = 1.2 # > 1.0 for brighter, < 1.0 for darker
contrast_factor = 1.5 # > 1.0 for more contrast, < 1.0 for less contrast