| Thumbnail Managing Standard | ||
|---|---|---|
| <<< Previous | Next >>> | |
The image format for thumbnails is the PNG format, regardless in which format the original file was saved. To be more specific it must be a 8bit, non-interlaced PNG image with full alpha transparency (means 255 possible alpha values). However, every program should use the best possible quality when creating the thumbnail. The exact meaning of this is left to the specific program but it should consider applying antialising.
Beside the storage of the raw graphic data its often useful to provide further information about a file in its thumbnail. Especially file size, image dimension or image type are often used in graphic programs. If the thumbnail provides such information it avoids any need to access the original file and thus makes the loading faster.
The PNG format provides a mechanism to store arbitrary text strings together with the image. It uses a simple key/value scheme, where some keys are already predefined like Title, Author and so on (see section 4.2.7 of the PNG standard). This mechanism is used to store additional information.
Beside the png format there is another internet standard which is important in this context: the URI mechanism. It is used to specify the location of the original file. Only absolute URIs (including the scheme) are used to determine the original uniquely.
The following keys and their appropriate values must be provided by every program which supports this standard. All the keys are defined in the "Thumb::" namespace or if already defined by the PNG standard without any namespace.
Table 1. Required keys.
| Key | Description |
|---|---|
| Thumb::URI | The absolute uri for the original file. (eg file:///home/jens/photo/me.jpg) |
| Thumb::MTime | The modification time of the original file (as indicated by stat, which is represented as seconds since January 1st, 1970). |
If it's not possible to obtain the modification time of the original then you shouldn't store a thumbnail for it at all. The mtime is needed to check if the thumbnail is valid yet (see Detect modifications). Otherwise we can't guarantee the content corresponds to the original and must regenerate a thumb every time anyway.
Table 2. Additional keys.
| Key | Description |
|---|---|
| Thumb::Size | File size in bytes of the original file. |
| Description | This key is predefined by the PNG standard. It provides a general description about the thumbnail content and can be used eg. for accessability needs. |
| Software | This key is predefined by the PNG standard. It stores the name of the program which generated the thumbnail. |
There are surely some situations where further information are desired. Eg. the Gimp could save the number of layers an image has or something like this. So if an application wants to save more information it is free to do so. It should use a key in its own namespace (to avoid clashes) prefixed by X- to indicate that this is an extension. Eg. Gimp could save the layer info in the key X-GIMP::Layers.
However, regarding to the filetype there are some keys which are generally useful. If a program can obtain information for the following keys it should provide them.
Table 3. File type specific keys.
| Key | Description |
|---|---|
| Thumb::Image::Width | The width of the original image in pixels. |
| Thumb::Image::Height | The height of the original image in pixels. |
| Thumb::Document::Pages | The number of pages the original document has. |
| Thumb::Movie::Length | The length of the movie in seconds. |
With this approach a program doesn't have the guarantee that certain keys are stored in the thumbnail. They may be created by another program which only provides the required ones.
Most of the programs out there which make use of thumbnails use a fixed set of sizes for them. Often the user can choose a size from this set. However, there is definitely a need for supporting multiple thumbnail sizes. Because of this we define a set of common used values. Maybe these don't cover all cases, but for the sake of a standard an existing program should adapt these.
Table 4. Allowed thumbnail dimensions.
| Dimension (width x height) | Descriptive name |
|---|---|
| 48x48 | very small |
| 64x64 | small |
| 96x96 | medium |
| 128x128 | large |
| 144x144 | extra large |
| 160x160 | super large |
| 192x192 | ridiculous large |
A program doesn't need to generate a thumbnail for all sizes. Only for the one it actually needs. The sizes define just a rectangle area where the thumbnail must fit in, so don't scale every image to a rectangle thumbnail but preserve the ratio instead. Also, if an image is smaller than 48x48 pixels it shouldn't be scaled at all, just use the original image.
If a program still wants to use another thumbnail dimension than the ones specified in the table, it can read and write the next bigger one and scales it down to the desired size internally.
| <<< Previous | Home | Next >>> |
| The .thumbnails Directory | Thumbnail Saving |