'Inno Setup "Out of Sytem resources" on background image

I'm creating an installer with Inno Setup and I want to set a .bmp image as background, but the "Out of System resources" keeps popping up randomly (sometimes it pops up, sometimes it doesn't) in the Welcome page and in the "Setup completed" (basically the only pages with the image).

Error screenshot

I tried different sizes and bit depths but that doesn't solve it (and it never says "Invalid Bitmap image", so I don't think that's the problem).

Do you guys have more info about this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source