Import Filters


EasyCopy can use import filters to extend its range of supported file formats. An import filter is any program which can detect a file format and convert it to another (known) file format. If a file is not immediately understood by EasyCopy the filters apply in the sequence in which they are defined. A number of filters are automatically configured when you install EasyCopy. These are described below. Your system administrator may modify these filters or add more filters by editing the filters file.

Filter Definition File
Filters are defined and configured in the filter definition file filters in the easycopy/system directory. Each line defines one filter by means of three fields:
"detection"   "command-line"   "description"
The first field describes the file type detection. This can be the "magic word" for a file format (a short unique sequence of characters in the beginning of the file, for example "8BPS" which is a unique identifier for an Adobe Photoshop image file. Special characters in the "magic word" may be specified by their octal code, for example \033 for an escape character.

Some file formats do not have a simple "magic word". They have certain other characteristics, and EasyCopy is prepared to detect these. Filter definition lines for these formats contain a reserved word in place of the "magic word".

Strictly, the "reserved word" is first assumed to be the name of an executable program that can do a safer file detection. If a program of that name cannot be found on the path it is assumed to have the fixed meaning as described below. However, this feature is not currently used by any of the filters distributed with EasyCopy.

The following reserved words are known:
*xzASCIIPlain ASCII text file
*xzPOSTSCRIPTPostScript files
*xzPDFPortable Document Format
*xzCalcompCalComp plot files
*xzCGMComputer graphics metafiles
*xzHPGLHP-GL files
*xzGRAPHICSAny of the three vector formats listed above
The second field contains the command line necessary to convert a file on stdin from one format to another. This command line program must read from stdin and write to stdout (if necessary, you must hide the program in a script). You may use environment variables in the command string. You can also use any of these three symbols:
%RPrinter resolution (in dpi)
%WMaximum page width (in points)
%HMaximum page height (in points)
These symbols are substituted at run time according to the current printer setup.

The third field is a short text string that is displayed next to the preview image in the Open dialog. If this string is terminated with ".\n" (period, newline) this will terminate the displayed text. Otherwise a new type (originating from the interpretation of the converted file) is appended. Include ".\n" if you want the description to be final. Terminate with a blank if the next type should also be displayed (for example "gzipped ").

Example: (Windows)
If you have a program that converts Adobe Photoshop images to Portable Pixel Map you can install it as a filter by putting this line in the filters file:
"8BPS" "C:\\Program Files\\My Filters\\pds2ppm.exe" "Photoshop image.\n"
The "magic word" is "8BPS", and the program is invoked as c:\program files\my filters\pds2ppm.exe.

The above is only an illustrative example. AGI has no knowledge about the availability of any pds2ppm program.


Default Filter Definitions
The default filter definitions are described under these topics:
Copyright © 2005, AGI (autoGraph international), www.augrin.com.