Which format to save a background in
A generated background is an unusual image: enormous areas of near-identical colour, no edges, no detail, and — if it is dithered — noise in every single pixel. That combination pushes each format somewhere different from where a photograph would.
What each format does with a ramp
PNG
Lossless, and it compresses by predicting each pixel from the ones above and to the left. On an undithered ramp that prediction is nearly perfect and the file is tiny. Add dither and the prediction fails on every pixel, which is why the same picture can be four hundred kilobytes or eight megabytes depending on one checkbox. PNG is the right answer for flat colour, for anything that has to be exact, and for a design going into a pipeline that will re-encode it later.
JPG
Lossy, working in eight by eight blocks with a frequency transform. A smooth ramp is the easiest thing in the world for it: almost no high-frequency content, so it throws away almost nothing and the file is small. Its weaknesses show up elsewhere — ringing around hard edges, and colour subsampling that softens a saturated hue boundary. It also cannot hold grain honestly: dither and JPG fight each other, because one adds high-frequency noise and the other exists to remove it.
WebP
Lossy or lossless, and on this material it is usually the smallest of the three by a wide margin. The reason to hesitate is compatibility rather than quality: some desktop software and some older print workflows still will not open one. Where you control what opens the file, it is the efficient choice.