[Python] How to implement the Java-like gradient into Python using Pillow?

Discussão em 'Python' iniciado por Stack, Setembro 24, 2024.

  1. Stack

    Stack Membro Participativo

    I was using pixie for my project at the moment for a better gradient generating.I found it hard to implement the same effect using Pillow when I first refracted the project from Java.So I found this library instead. But,there is a serious performance issue when I needed to draw a lot (at least 70,can be told from the example in the README.md) of gradient rounded rects.Took nearly 0.3s each and because the image context is binded to the coordinates,it seems that the only options left was either switch to pillow and implement this Java-like gradient,or completely back to Java. Any ideas?

    tried: A lot of googleing PIL.Image.radial_gradient/linear_gradient(not working as expected) https://stackoverflow.com/questions/32530345/pil-generating-vertical-gradient-image(not really what I expected,should have an angle or sth)

    https://gist.github.com/weihanglo/1e754ec47fdd683a42fdf6a272904535(this nearly met my expectations,but it only has the linear method?)

    expected:See README.md

    Continue reading...

Compartilhe esta Página