I’m writing webpage that will display hundreds of pictures. Problem is size of image(+-5MB). This images are background-image of div. I use JS for changing this background-image.(sometimes 1 per sec.) Is there any way how to shrink those images or how to speed up loading? (I can't modify this images by Photoshop or another similar SW. I must use the original.)
-
are you able to adjust it on the server? – Daniel A. White Aug 12 '12 at 21:47
-
1What do you mean you want to resize the image, but you must use the original? Your question is contradictory. – Brad Aug 12 '12 at 21:55
-
Possible duplicates http://stackoverflow.com/questions/1906899/smart-way-of-resizing-images-in-php, http://stackoverflow.com/questions/12661/efficient-jpeg-image-resizing-in-php, http://stackoverflow.com/questions/4590441/php-thumbnail-image-resizing-with-proportions – Adi Aug 12 '12 at 21:55
-
According to his comment on the answer he's looking for a python solution so those linked questions aren't duplicates. – ThiefMaster Aug 13 '12 at 23:14
1 Answers
What do you mean you must use the original if you wish to shrink the images? In my opinion the file size is not suitable for a web application and you must decrease the file size of these. If you have access to a server side technology like PHP or ASP.NET you can modify the images before displaying them using libraries like ImageMagick (http://php.net/manual/en/book.imagick.php) or ASP.NET Sprite and Image Optimization Library (see http://www.hanselman.com/blog/NuGetPackageOfTheWeek1ASPNETSpriteAndImageOptimization.aspx) but these will use resources to process and thus your site will still have an performance overhead.
I advise you to modify your images using a tool and don't have the server or browser modify these. If you don't have access to a tool like Photoshop or GIMP you can use online tools to create reduced versions of your originals like Yahoo's smush.it - http://www.smushit.com/ysmush.it/
Not the best answer but I hope it helps.

- 14,805
- 31
- 98
- 143