![]() ![]() Hopefully this color can be represented by palette, as it is present in your noisy image. You can try to use color '#ff9900' instead of 'orange'. 'orange' has value of #ffa500 and can't be represented by such palette, so the background is filled by nearest available colors. As your image contains colors #ff9900 and #ffcc00, then palette presumably consists of hex values 00, 33, 66, 99, cc, ff for each byte and has size 6圆圆 = 216, which fits nicely into 256 possible values. Most likely PIL uses very basic algorithm to convert from RGB format to indexed format, which is required by gif. This is dithering that happens, because gif can contain only colors from palette of size 256. Why am I getting either nice background or nice fonts but not both? Is there a workaround? These are examples with RGB mode (fonts are well) and P mode (fonts are awful): UPD I was able to fix the background by changing image mode to "P", but in this case my fonts became unreadable. What's the reason of the noizy background and how can I fix it? I found some info that I have to use getpalette from the first frame and putpalette for all the other frames like this: for x, i in enumerate(range(10)):īut it just gives me: ValueError: illegal image mode. The problem is that whenever I use Draw.text, image's background is getting some kind of white noze: Images.save("result/pil.gif", save_all=True, append_images=images, duration=1000, loop=0, format="GIF") I'm creating a simple GIF animation using PIL: from PIL import Image, ImageDraw, ImageFont ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |