-
I have tried this, and I get the transparent background I expected: def setup():
size(50, 50)
sf = 10
f = createGraphics(width * sf, height * sf)
beginRecord(f)
f.scale(sf)
circle(6, 6, 10)
endRecord()
f.save("out.png") But in py5 I get a black background. Even if I try def setup():
size(50, 50)
sf = 10
f = create_graphics(width * sf, height * sf)
begin_record(f)
# f.clear() # doesn't help
f.scale(sf)
circle(6, 6, 10)
end_record()
f.save("out_py5.png") Is this a known issue or is it by design? Am I doing something wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
you should set parameter drop_alpha=False: f.save("out_py5.png", drop_alpha=False) by default py5 drops the alpha channel for compatibility with file formats like jpg |
Beta Was this translation helpful? Give feedback.
-
Cheers @hx2A! I was trying to show PNG export to someone today, and this didn't work as I expected: extra_canvas.save('out.png', drop_alhpa=False) I was going nuts, then I saw my mistake. Can you see it? Is this a consequence of passing the **kwargs to a delegated Pillow save mechanism? Should we open an issue? |
Beta Was this translation helpful? Give feedback.
you should set parameter drop_alpha=False:
f.save("out_py5.png", drop_alpha=False)
by default py5 drops the alpha channel for compatibility with file formats like jpg