Specification
All PICO format icons are stored in a ZIP file in a directory with the real name of the
icon (this prevents file name chopping if it happens to pass by an OS such as DOS). The
icon variations, which represent different sizes and number of colours, are stored as
individual files in this directory. The names of the files indicate what sort of icon
configuration it contains. The name of the image is as follows :
width x height x colour depth in bits
So, if the image represents a 32 by 32 icon with 256 colours its file name would be as
follows:
32x32x8
An example structure would be as follows:
.-ZIP File---------------.
| |
| MyIcon | Folder with icon's name
| |----->PICO.txt | Icon info
| |----->32x32x1.png | image is 32 by 32 and is black and white
| |----->32x32x2.png | image is 32 by 32 and has 4 colours
| |----->32x32x8.png | image is 32 by 32 and has 256 colours
| '----->42x42x8.png | image is 42 by 42 and has 256 colours
|________________________|
The icon mask is defined using the alpha channel of the png
image. Although the alpha channel is able to represent the
amount of transparency for each pixel, in most case only one
colour will actually be represented as transparent (this is
because most icon formats only have bitmap mask).
Although PICO uses the ZIP file format as a container, the file type is PICO. This
approach is used because it allows for quick identification of the file type by most
users and avoids the file being associated with programs that would treat it as ZIP file.
The PICO file can contain multiple icons, which each exist in their own directory, in
this case the file type is PICL, though and converter should not discriminate between
the two - a check for the number of folders contained should always be done. A PICO.TXT
file should be included in the icon directory. The first few lines should read as
follows:
PICO: This is a PICO format icon.
Use a PICO converter to convert it to your platform's format.
--
The two dashes are used to allow possible extra information, specific to PICO, to be
added in the future. They simply say 'PICO information ends here'. Below the two dashes
you can place any custom information you wish, this could include information on the
author and any other information that should stay with the icon.
Pseudo Code
Below is some pseudo code that illustrates a possible conversion process
for converting from a PICO icon to a native icon format:
Opening a PICO file:
Is File a ZIP format file?
No: Is this a native icon format?
No: print error message, end
Yes: jump to native->PICO conversion routine
Count number of folders and get their names
For each folder do:
Get Directory contents
Does folder contain a file PICO.TXT
No: skip folder
Create a temporay native icon file [Get location of temporary folder]
For each file do:
Get file name
is icon variation supported?
No: skip file
convert it to native format
place it in the temporary file
Were any icon variations written to the temporary file?
Yes: move it to the destination folder, close the file
[Get location of dest. folder]
No: remove temporay file and indicate error in message log
Were there any valid folders:
No: Print error message
Projects
As projects get under way they will be marked indicated below.
Plans
Below are mofications to the specification that are currently under discussion:
- Masks
- More than one transparency colour