EyalAr / lwip

Light Weight Image Processor for NodeJS
MIT License
2.37k stars 229 forks source link

ICO support #38

Open griiettner opened 10 years ago

griiettner commented 10 years ago

I would suggest a .ico support. The reason why I'm doing this request, is that I was ready to start writing a gulp plugin to auto generate favicon's PNG is fine, but the .ico still play a good portion of it... There is already a node plugin that does such thing, but it requires imagemagick to be installed and I was looking for an alternative base only on node and not dependent on external stuff...

EyalAr commented 10 years ago

@griiettner Good point. I'm not very familliar with the structure of .ico file, but if I'm not mistaken, those are just bitmaps, right? Will implementing support for BMP format solve this?

griiettner commented 10 years ago

I don`t believe that implementing BPM will sove this... ICO has a very different approach, where inside one single file you can have different images and sizes...

four43 commented 10 years ago

Ico files seem like a thing of the past. Most browsers can handle more sane formats: http://en.m.wikipedia.org/wiki/Favicon

What's your target version that you need an Ico file?

EyalAr commented 10 years ago

Indeed all browsers today can use PNG as favicons. I'll keep the .ico format in mind, but it's probably not a priority (gif, for example, is more urgent); unless:

  1. more people ask for it. or -
  2. somebody wants to pick it up and send a pull request.
jaydenseric commented 8 years ago

@EyalAr I for one would love to see this. @four43 .ico is part of the HTML5 spec and it is still best practice to include it, the HTML5 Boilerplate project has a favicon.ico in the root and there is no discussion to remove it. Imagemagick is the only non Node CLI tool I use, and only because there is nothing on NPM that can convert .png to .ico. If you were to add this feature I could see a lot of people using this project overnight.

Here is the Wikipedia summary of the Microsoft .ico spec:

An ICO or CUR file is made up of an ICONDIR ("Icon directory") structure, containing an ICONDIRENTRY structure for each image in the file, followed by a contiguous block of all image bitmap data (which may be in either Windows BMP format, excluding the BITMAPFILEHEADER structure, or in PNG format, stored in its entirety).

Here is the Imagemagick source code for .ico read/write.

Here is a Java .png to .ico implementation from 2013.