Skip to content

Latest commit

 

History

History
68 lines (44 loc) · 1.83 KB

File metadata and controls

68 lines (44 loc) · 1.83 KB

License Python

Gradient Background Generator

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.

Features

  • 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.

Prerequisites

You need Python 3 and the Pillow library installed.

pip install Pillow

Usage

  1. Open the script in your code editor.
  2. Run the script via the command line:
python gradientBackground.py
  1. The script will generate a file named gradient_background.png in the same directory.

Customization

Changing Colors

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...
]

Changing Size

To change the output resolution, update the width and height variables:

width, height = 3840, 2160  # Example for 4K

Adjusting Brightness and Contrast

You 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

License

MIT