You can set ToyViewer to display any image format if there is a filter program to ppm (pbm, pgm, ppm, or pnm). See PBMPLUS, or Netpbm.
To do so, definition file "~/.toyviewerrc" or "~/Library/ToyViewer/rc" have to be presented. Additionally, you can have the description for PowerPC Mac in "~/Library/ToyViewer/rc.ppc", and the description for Intel Mac in "~/Library/ToyViewer/rc.i386".
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/Contents/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.
Image files specified in the definition file can be opened using open panel (select "File / Open " menu). You can also open image files by dragging the icon onto the icon of ToyViewer placed on the Dock. Note that you can't activate ToyViewer by double-clicking the icon of the image file.
Suppose that you frequently use gray-scaled raw image data for your research. The image has 320x200 pixels and no header. Each byte in the data represents one pixel (value range: 0 - 255). Extension of files is "gs". You can display easily this format with ToyViewer.
First, make a executable shell script as below (filename=gstoppm.sh):
#!/bin/sh echo "P5 320 200 255" cat $1
This simple script is a converter to pbm format. Then, edit "~/Library/ToyViewer/rc" and add next line:
gs ~/Unix/bin/gstoppm.sh $
If you want to put the script in "~/Library/ToyViewer", type like this.
gs ~/Library/ToyViewer/gstoppm.sh $
Restart ToyViewer, and you would be able to display "gs" files with ToyViewer.
ToyViewer provides a few functions for AppleScript to control windows. They can be seen from the script editor.
They are experimental implementation, however. They would be modified, and new functions might be also added.