Thumbnail


Introduction

Thumbnail is an application which creates thumbnails for image files. By default it overwrites the mini icon and the icon which are displayed in Tracker windows and creates an additional attribute for the image file which contains a larger thumbnail (with a maximum side length of 96 pixels) which may be used by other applications. Furthermore it creates two integer attributes containing the width and height of the original image. See here for a detailed description which attributes are created.

The original image is left untouched, of course.

A preference panel allows you to select which attributes are actually written.

Thumbnail is accompanied by a Tracker add-on named MakeThumbnail which simply launches Thumbnail and sends the current selection to it.

The following image shows a Tracker window after Thumbnail has overwritten the icons of the image files (all images have been painted by Eric Hotz):

Requirements

Thumbnail uses the Translation Kit which is built into the BeOS. It can create thumbnails only for image files whose format can be translated by the handlers you have installed in the home/config/add-ons/Translators folder.

Furthermore Thumbnail requires libprefs.so from Jon Watte to save its preferences. This shared library must be installed in the home/config/lib folder or anywhere else the BeOS can find it. (The Thumbnail distribution contains libprefs.so from the version 1.2.5 of the libprefs package.)

(Thumbnail requires a shared library named libThumbnail.so which comes with the Thumbnail distribution and must be installed in the home/config/lib folder or anywhere else the BeOS can find it.

This shared library may be used from other programs. See below for further informations.)

Creating Thumbnails

After each image of a selection has been processed, the created icons and the created thumbnail are displayed. Pressing the Stop button interrupts the processing of the following images. The About menu item opens a window with information about the application.

This is the Thumbnail window after dropping the image file Card024.gif (by Eric Hotz) on it.

Preferences

The preference window can be accessed by selecting the Preferences menu item in the Thumbnail window.

On the "Thumbnail Creation" tab you can mark if alerts telling that the format of a specific file has not been understood shall be suppressed, if icons or the large thumbnail shall be shown and/or written into attributes (written icons/thumbnails are always shown), if the large thumbnail shall be dithered to the 8 Bit color palette instead of being created as true color image and if the resolution of the original image shall be written into a width and height attribute.

On the "MIME Database" tab you can mark if the MIME database shall be updated each time Thumbnail is launched. This updating adds a width and a height attribute to each subtype of image if not already present. This makes it possible to view the width and height attributes of image files with the Tracker.

Description of the buttons:

Closing the preferences window doesn't change anything.

Scripting

You can use 'hey' which has been written by Attila Mezei (or anything else that sends scripting messages) to script Thumbnail. Description of the suites:

suite/vnd.dragonfly-pref-root

Property name: label of the tab, i.e. "Thumbnail Creation"
Specifiers: B_DIRECT_SPECIFIER only
Messages: '*REV', '*REL', '*DEF', '*USE', '*SAV' with the same functions as the appropriate buttons (see last section).
Data type: none

suite/vnd.dragonfly-pref

Property name: label of the preference, e.g. "Suppress Alerts" or "Show"
Specifiers: B_DIRECT_SPECIFIER only
Messages: B_GET_PROPERTY, B_SET_PROPERTY, '*USE' for getting the value in use, setting the displayed value and using the displayed value.
Data type: bool

Examples:

Note the '*USE' command. Without this, the new values won't be used!

hey Thumbnail get "Suppress Alerts" of "Thumbnail Creation" of Preferences
hey Thumbnail set "Suppress Alerts" of "Thumbnail Creation" of Preferences to true
hey Thumbnail set "Write" of "Mini Icon" of "Thumbnail Creation" of Preferences to false
hey Thumbnail '*USE' "Thumbnail Creation" of Preferences
hey Thumbnail load "file(/boot/optional/images/Fearless Leader)"

Attributes format

The format of the attributes which are created by Thumbnail is the following:

Source Code and shared library

A shared library named libThumbnail.so is included, as well as the source code to create this library. The library is used by the application Thumbnail and may be used freely by your programs. Simply include the header file Thumbnail.h which declares a class named DThumbnail and link with libThumbnail.so. The class DThumbnail lets you easily create thumbnails from BBitmaps and read/write them from/into file attributes. The following example shows its usage:

// bitmap is assumed to be a BBitmap-pointer of an image
// for which you want to create a thumbnail
// view is assumed to be a BView where you want to display
// the thumbnail
// ref is assumed to be an entry_ref to the file where the image
// comes from

bool dither = true;         // the thumbnail will be dithered
DThumbnail thumbnail(bitmap, dither);

if (thumbnail->Bitmap())    // will be NULL if the thumbnail couldn't be created
{
    view->DrawBitmap(thumbnail->Bitmap());

    BNode node(&ref);
    thumbnail->WriteThumbnailAttribute(&node);
    thumbnail->WriteIconAttribute(&node);
    thumbnail->WriteMiniIconAttribute(&node);
    thumbnail->WriteResolutionAttributes(&node);
}
NOTE: There has been a change to the library: the type of DThumbnail::cThumbnailSize has been changed from int32 to enum. This has been necessary due to a bug in the exporting mechanism.


Copyright © 1997, 1998
Thorsten Seitz. All rights reserved. Home page. Your feedback is very much appreciated.