Format of the definition file is below:
<ext> <path> <args> ...Where, <ext> is an extension of image files, <path> is a full path name of the filter program, and <args> are arguments for the program. One of <args> should be `$', which is replaced by the image file name. If the first character of path is `~', it is extended to the home directory. If `@', it is extended to the application directory (.../ToyViewer.app/Resources). Lines beginning with `#' are comments. The following are examples.
jfif @/djpeg $ ras /usr/local/netpbm/bin/rasttopnm $ sgi /usr/local/netpbm/bin/sgitopnm $ g3 /usr/local/netpbm/bin/g3topbm -reversebits $ qwe ~/Unix/bin/qwe2ppm $ -This customization is prior to pre-definition of ToyViewer.app. For example, if you write specification for extension `gif', gif files will be opened using specified filter.
Besides, if filter service programs such as ImageViewer.app, OmniImageFilter, or McFilter are installed, other image formats (e.g., Mac paint, sun raster, ...) can be read.
Image files treated by service programs, or specified in the definition file are opened using open panel (select "File / Open " menu) or by command-dragging the icon onto the tile of ToyViewer. Note that you can not activate ToyViewer by double-clicking the icon of the image file.
If the service fails because of incomplete image file, for example, ToyViewer returns a small substitutive image to show that some error occurred.
If you specify new filter programs in the way as described above, you can also make ToyViewer provide image conversion filter services for image formats that is newly added. To do so, definition file "~/Library/Services/ToyViewer.service" have to be presented.
Now, let's suppose that we are going to add new formats that are specified in previous example to filter services. The contents of ToyViewer.service is the following.
Filter: convertToTIFF Port: ToyViewer Send Type: NXFilenamePboardType:jfif Send Type: NXFilenamePboardType:ras Send Type: NXFilenamePboardType:sgi Send Type: NXFilenamePboardType:g3 Send Type: NXFilenamePboardType:qwe Return Type: NXTIFFPboardType Executable: /LocalApps/ToyViewer.app/ToyViewer Timeout: 60000Once this file is ready, restart ToyViewer to make enable to provide filter services.
#!/bin/sh echo "P5 320 200 255" cat $1This simple script is a converter to pbm format. Then, edit "~/Library/ToyViewer/rc.arch" and add next line:
gs ~/Unix/sh/gstoppm.sh $If you want to use filter service for "gs" images, make "~/Library/Services/ToyViewer.service" as the following:
Filter: convertToTIFF Port: ToyViewer Send Type: NXFilenamePboardType:gs Return Type: NXTIFFPboardType Timeout: 60000Restart ToyViewer, and you would be able to display "gs" files with ToyViewer.