Idk what Pillow is or how it exports, but you could use GDScript to save it as an image with a 32 bit color depth. Then it would run slow just once.
var image := Image.create(width, height, false, Image.FORMAT_RGBF)
for i in range(0, stars_x.size()):
var color := Color(stars_x[i], stars_y[i], stars_z[i])
var pixel_coord: Vector2i = get_pixel_coord(i) # however you want
image.set_pixelv(pixel_coord, color)
image.save_exr("user://my_file.exr") # or save_png, I think both support f32 color components