I am creating an image in PIL to set as the desktop background using ctypes, however it is incredibly slow to save to a file then pass in the absolute path.
image.save('file.png')
ctypes.windll.user32.SystemParametersInfoW(0x14, 0, 'file.png', 0x2)
Is there anyway to directly pass in the image data, be it by casting to numpy array or bytes directly into the windll to speed up my code?