[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: kimgio_ico_write() is broken
From:       Malte Starostik <malte () kde ! org>
Date:       2001-06-28 16:49:47
[Download RAW message or body]

On Donnerstag, 28. Juni 2001 17:48, Claudiu Costin wrote:
>         Hello friends,
>
>   A short story:
> I need to generate MS ICO files 16x16-16colors
> (aka favicons). Well I searched on the Net and
> found nothing for Linux. The ONLY free tool is
> a java app at www.favicon.com. Even Adobe
> Photoshop, Corel Photopaint dont't know to
> work with such simple format. On Linux,
> the full featured ImageMagick don't handle
> writing.
>   Sorry for long story :)
>
>   So, well we have KDE with kimgio plugin based
> library. But it can read MS ICO files,
> but write BAD (tm) ones. I've made a simple
> KDE program (sent to Coolo) and a Perl script
> to extract info from ICO files (even an ASCII
> rendering is posible) and found errors in writen ICO file.
>
>   To be technical, here is a info dump from www.kde.org
> favicon (which is a good icon):
I generated it on Windows with an icon editor before i added writing 
capabilities to kimgio_ico :)

> As you may observe "bitmap height=32"
> because are 2 bitmaps in ICO file. But
> KDE set bitmap height to 16!
> Frankly, kimgio use DIB manipulation
> classes from Qt. So I think there is
> the bug.
This is new to me. From what I saw in .ico files, the bitmap of course 
contains a bitmap twice as high as the icon's dimensions, but the header 
specifies the icon's height. Also, the second half of the bitmap is always 
1-bit regardless of the icon's depth. So basically the data consists of
DIB header
DIB data in the format and dimensions described in that header (XOR-pane)
DIB data in the same dimensions but always 1-bpp (AND-pane)

Did I get that wrong?

>   My question: could some one
> fix that and make an audit on this library.
> It's a shame that under Linux is no
> favicon editor and an
> <put_your_format_here> to MS ICO converter.
In theory, kiconedit from kdegraphics can write .ico files.
Of course kimio_ico has a little shortcoming in that it can only produce .ico 
files with exactly one icon in them (.ico's can contain multiple icons) and 
on reading it defaults to 32x32 with the depth that best matches the root 
window's depth. You can specify different preferences via 
QImageIO::setParameters() with a string of the format "size:depth" where size 
is e.g. 16 for 16-colour, 256 for 8-bit and 0 for high/truecolour.

-Malte

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic