mini abstract logo ajmas's web site : pico

PICO 1.0 - The Cross-Platform Icon Format

Contents

  1. Introduction
  2. Specification
  3. Pseudo Code
  4. Projects
  5. Plans

Introduction

With the advent of the graphical user interface (GUI) came the icon, a small image used to represent a file or other item in the interface. As operating systems came out so did diverse file formats for storing the icon images, unfortunately these file formats were rarely compatible. Now that icons artists are populating the Internet a need for a common file format has evolved so that they can provide their icons to the widest possible audience. This file format is PICO, or the Portable Icon Format.

PICO is designed in such a way that in makes maximum use of existing technologies. This enables for easy implementation of programs that make use of this file format. The base file formats for PICO are the ZIP archive format and the PNG image format. PNG was chosen as an image format due to its flexibility, it growing aceptance and because there are no licenceses to pay.

In almost every case a PICO icon will be converted to the local platform's icon format before being used. Because the icon formats are not always very well documented the conversion programs will be designed in such a way that they convert between PICO and the local format. This approach means that the programs can use common code for reading and writing PICOs and use the system's API for reading and writing the system format icon. Since PICO use a zip file as its distribution medium, there should be no need to zip up the file and when downloading the file the should not have to do any more work that if he was have to unpack any other icon collection.

An icon designer can easily create a PICO format icon by first creating a directory with the icon's name, then saving the variations in the folder with appropriate names. The final stage simply involves ZIPping up the folder and changing the type to PICO.

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

[ Back home ]

Best viewed with your favourite browser.
Javascript free.
Hosted by www.Geocities.ws

1