QPix v2.2x

An image database step by step


Chapter index | Step: 1 - 2 - 3 - 4 - 5 - 6

Step 4: Creating a thumbnail


It's about time we can start seeing things. Good thumbnails are vital to image databases and QPix lets you create great thumbnails easily using QPx_GetImageFileThumbnail.

In our example we will create a 160x160 thumbnail from the image file specified in the path name. The result will be an uncompressed picture stored in a 4D picture variable:

    `Create a thumbnail from the image file

    C_PICTURE($thumbnail) `The thumbnail
    C_LONGINT($thumbWidth;$thumbHeight) `Thumbnail width and height

    $thumbWidth:=160
    $thumbHeight:=160

    $error:=QPx_GetImageFileThumbnail($imagePath;$thumbnail;$thumbWidth;$thumbHeight)

    If ($error=qpx_noErr)

    `do here what you want with the thumbnail

    End if

Rotating and flipping

In some cases the original image does not have the right orientation. This can happen during batch scanning of slides: not all of the slides have the same orientation but there is usually no time for setting them correctly in the scanning device. As a result some thumbnails will come out rotated and users will not be able to see them properly in the database.

QPix can rotate pictures by any angle using the QPx_RotatePicture command.

Another command, QPx_FlipPicture, can be used to flip pictures horizontally and vertically. This can be useful with slides or transparencies that have been scanned with the wrong side facing the scanner's "eye".

Rotate and Flip commands can be invoked from a form object acting as rotation and flipping control, or the corresponding QPix menu items can be used directly by end-users.

Goto Step 5