I have a giant image that loads on the main page of my website, 1366*690px
I realized that is gigantic and decided to take considerations on speeding up the load times.
I first ran it through Smush.it
Then I coded some javascript to load different images dynamically dependent on the browser resolution :
<img id="poster" src=""/>
<script type="text/javascript">
var width = $(window).width();
//Attempt to lower bandwidth usage and load times by delivering a dynamic poster size
if(width<=320) {
$("#poster").attr('src', 'theme/images/poster/width320.jpg');
} else if(width>320 && width<=800) {
$("#poster").attr('src', 'theme/images/poster/width800.jpg');
} else if(width>800 && width<=1024) {
$("#poster").attr('src', 'theme/images/poster/width1024.jpg');
} else if(width>1024 && width<=1280) {
$("#poster").attr('src', 'theme/images/poster/width1280.jpg');
} else {
$("#poster").attr('src', 'theme/images/poster/width1366.jpg');
}
</script>
I am now asking for suggestions on how to speed up the process even more, I think i remember reading somewhere that splitting the image into two parts will speed up the page, Isn't this why when making gradients out of images, you make them 1px wide?(and repeat)?
The current file size by browser width looks like this:
<= 320px || 15.1 KB
> 320px && <= 800px || 67.8 KB
> 800px && <= 1024px || 101 KB
> 1024px && <= 1280px || 142 KB
> 1280px || 151 KB
NOTE: All of these images have a width of 100% in the css
I also know something is related to the amount of bit depth(8,16,24,32) and aplha I do not wish to lower the picture quality too much, how much do you consider acceptable for the web? My current bit depth is at 24, is that too much?
How else would you optimize such an image for the web?