dongwei4103 2014-09-27 19:58
浏览 77

如何自动创建由许多favicon网址组成的精灵

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.

  • 写回答

1条回答 默认 最新

  • dqg95034 2014-09-27 20:08
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP