I need to create a sprite that contains the favicon of 800+ websites.
My current issue is that I am generating much to many http request for images on one page and it has slowed down dramatically. I would like to find a program or script that will allow me to feed it the url of the image or the image it self and have it generate the sprite.
For example. The following Google url will pull the favicon from most all sites.
google.com/s2/favicons?domain=www.yahoo.com
I do not need to use the above but it's worth taking note of. It's a nifty way of retrieving the favicons.
The script or program would need to save each favicon and increment:
-16px 0px;
-32px 0px;
-48px 0px;
etc.
I've seen it done in javascript but that or PHP would be fine. If you know of any scripts or programs or anything at all that would be amazing.
You may try and use Imagemagick, a free and open source tool (most likely). I am not promoting it by any means but it is a nice tool that can be used as a commandline tool.
You may use the append
command to append two images. The documentation reads (pasting for reference):
-append
Join current images vertically or horizontally.
This option creates a single longer image, by joining all the current images in sequence top-to-bottom. Use +append to stack images left-to-right.
If they are not of the same width, narrower images are padded with the current -background color setting, and their position relative to each other can be controlled by the current -gravity setting.
You may read the documentation here. Download here.
Just append two images into one and then use the resultant image to append other icons.
Note: You need to check the format and conversion settings.