8. Thumbnail Creation Failures

Due to several reasons its possible that the generation of a thumbnail fails:

Under some circumstances a program want to preserve the information that the creation failed. Eg to avoid trying it again and again in the future. The problem is that the above mentioned issues are often program specific. Eg Nautilus can't read the native Gimp format xcf but of course Gimp can and could create thumbnails for them. Or one program uses a broken TIFF implementation which refuses to load an TIFF image but another one uses a correct implementation.

Because of this, its best to save these failure information per program. In the Directory Structure section there is already a 'fail' directory mentioned, which should be used for this. Every program must create a directory of it's own there with the name of the program appended by the version number (eg. $XDG_CACHE_HOME/thumbnails/fail/nautilus-1.0).

For every thumbnail generation failure of a readable image, the program creates an empty PNG file. If it's possible to obtain some additional information from the image (see Store Additional Information) they should be stored together with the thumbnail too, at least the required 'Thumb::MTime' and 'Thumb::URI' keys must be set. The procedure for the saving of such a fail image is the same as described in Thumbnail Saving. You must only use the application specific directory within $XDG_CACHE_HOME/thumbnails/fail instead of the size specific ones.

This approach has the advantage that a program can access information about a thumbnail creation failure the same way as it does with successfully generated ones.