There are a lot of libraries and plugins (mainly written in PHP) that can automatically resize images but to resize background images, is quite a different thing. Backstretch is a jQuery plugin that allows you to automatically resize background image on any page.
The functionality is simple, the plugin stretching any image to fit the page and automatically resizing when the window width or height changes. The images are fetched after the page is loaded so the users won’t wait for the image (sometimes would be big) to download. The plugin comes under MIT and GPL license so modify it as you wish.