Googlebot
Googlebot

Reputation: 15683

Script for optimizing images for web

In PHP, imagecreatefromjpeg() can optimize an image, as it saves the image with an appropriate quality for web. However, this is not the best option. I optimized again the php-generated image by Yahoo Smush and it optimized the image by a factor of 5-10%. This is not strange indeed; but alternatively I used http://www.imageoptimizer.net/ and it optimized my php-generated images by a factor of more than 50%.

This is indeed a significant improvement to save bandwidth and fast load of the webpages. I wonder what technology they use. They offer a windows-based application, but no description about their method.

Anyway, my question is how we can make a script (in php, perl, python, etc) to optimize to this extent?

Upvotes: 1

Views: 1895

Answers (1)

aurora
aurora

Reputation: 9627

I don't know anything about those algorithms involved for compressing and optimizing images, but i would believe, that they would get too slow, if implemented in pure PHP. I therefore would recommend using already available command-line tools and wrap them in a PHP class or script. Some of these tools are:

Upvotes: 2

Related Questions