Does PIL (Python Imaging Library) have methods to draw linear gradients or/and set clipping paths?
I’ve looked everywhere but I can’t find any examples that demonstrate how to use either. Or are there any other graphics libraries that can do similar tasks?
I’m not sure about PIL, but since you asked about alternatives as well, here’s an example of both linear gradients and clipping regions using wxPython.
wxPython isn’t strictly for image manipulation but it can get the job done.
Output of this program:
This example uses a standard drawing context, but there’s also
GraphicsContextwhich provides additional functionality and better rendering (anti-aliasing):http://www.wxpython.org/docs/api/wx.GraphicsContext-class.html