PIL: Generating Vertical Gradient Image
问题 In Android, I used the following code to generate a gradient background that I need: <gradient android:angle="90" android:startColor="#40000000" android:endColor="#00000000" android:type="linear" /> The background goes from light to relatively dark from top to bottom. I wonder how to do the same in Python with PIL, since I need the same effect on another program written in Python. 回答1: Here's something that shows ways to draw either multicolor rectangular horizontal and vertical gradients.