JACK WHITHAM PhD MEng
Professional Activities - Publications - Software - Articles
   
       
    Home -> Software -> Thumbnail    

Introduction

Thumbnail is a Python extension (Python + C) that was written to support the PhD work of my brother Roger. It carries out two tasks:

Using the Thumbnail extension, a Python program can provide a thumbnail generating service for Flash applets. This is useful for experiments involving new user interfaces for managing documents. Roger has contributed ActionScript 3 classes that interface to the service.

The thumbnails are generated using IExtractImage, which is part of the Windows XP API. Windows XP uses IExtractImage to produce the thumbnail images that appear in the default XP file browser. (Earlier versions of Windows lack this feature.) The link to Flash uses Local Connection, which is implemented using some public domain C code written by Philippe Elsass. The two parts of the program are turned into Python methods using SWIG.

Build instructions

Unfortunately, due to software incompatibilities, you can only use a Python extension that was compiled with the same version of Visual Studio as Python itself. Therefore, you should download the Python source and compile it yourself before you compile this extension. Then the two programs will match. For this reason, I am not distributing the binary version of this program.

Compile Python 2.5 (or later) using Visual Studio. Then unzip the thumbnail software (below). Edit the "build_extension.bat" script, and set the correct location of the newly compiled python.exe. Then run "build_extension.bat" in a Command Prompt window.

Usage example

The component parts of the module (once compiled) are: The other files in the package demonstrate how the module works: When you run demo.py (using your own python.exe), it should
  1. create "thumbnail.jpg" from "demo.png"
  2. wait for a LocalConnection (forever).
You can interrupt this with control-C, closing the window, etc. However, if you open client.swf in a web browser, you get a text entry box. If you type text into that box and press the send button, it should (1) be received by demo.py, which (2) prints a message and (3) echoes the message back to client.swf, which should display "You said: " followed by whatever you typed. client.swf is from http://osflash.org/localconnection.

API

The following functions are in the api.py module: In testing, I have only seen SeriousProblem occur when trying to make thumbnails on a Windows 2000 machine. (This doesn't work.) SeriousProblem might also be triggered by some errors relating to local connections.

Files




       
  Copyright (C) Jack Whitham 1997-2010