Animated GIF file


Simply use gifmerge to merge individual gif images into a single animated GIF file, provided
such gif images (in same size) exist:

    gifmerge -l0 -50 infile1.gif infile2.gif ... > outfile.gif
The expression *.gif can be used to replace the above input file list if all file names are in order.
The first option -l0 means endless loop, the second one -50 (or other number) sets the time
interval (in 1/100 th second) between two frames. Another important option -d0 solves black
stripes caused by size difference among images. Use -help to find all available  options.

The animated GIF file generated, outfile.gif, can then be viewed through web browser or put  in
Powerpoint presentation to show animation effect.

Note: The software gifmerge is installed on lobster (~/software/gifmerge/), and is available
free on web.


Animation by Javascript



This is suitable for gif, png, jpg format image files. More flexible and functional -- forward
and backward, fast and slow, pause, single frame, etc. The image files should be numerically in
order, e.g., f1.png, f2.png, ..., f35.png. The sample javascript file anim_index.shtml should be edited
(only need to change image file name, starting and ending image numbers, frame pixels) and
put a HTTP link to web browser (rename to index.shtml).

Prepare Image Files from multipage Postscript file



From multipage postscript file, infile.ps, pstoimg is a good program to convert it to individual
png or gif format images:
 
    pstoimg -density 100 -crop a -multi infile.ps
or
    pstoimg -type gif -density 100 -crop a -multi infile.ps
The default format is png, as the first example above does. By setting density to a high value,
e.g., 300 dpi, the converted image has very high quality and of course large file size (The default
density is 72 dpi). The -density value of 100 can produce decent image for screen display (better
than images converted using convert command). -crop a does the job of cropping all surrounding
white space. The above command, pstoimg, can be used for converting single page PS file by
dropping the flag -multi.

In order to crop to exact desired frame size (rather than -crop a), one can first generate uncropped
png or gif images, then use convert
-crop XxY+x+y (e.g. -crop 645x581+136+262) to make the cropping.
The exact frame size can be found using xv utility (by select a window and show image info). This way,
one can also get image format other than png and gif.

Note: Although command convert -crop can be directly used to convert PS file to desired image
format, the resulting images have poor quality.

Example script files can be found on lobster:/home/fkong/images/boeing_osse/

A Note on Splitting Multipage PS File using gs or ghostview


[low quality approach!!!]
One can use gs of ghostscript to write out individual page:
    gs -dNOPAUSE -dBATCH -sDEVICE=pswrite -sOutputFile=out%03d.ps infile.ps
The %03d is replaced by 3-digit values referring page number (one can use %d only). The output
device: png16m can be used to output 24bit RGB png images (coupled with -r<resolution>).

Note: The single page PS file generated this way, when converting to EPS, is not recognized by MSWORD.

[high quality approach]
When using ghostview (or GSview, or psselect -p#) to manually write out selected page, it might not be
viewable or convertable to EPS. This is true when color map info (something like 'ct 255 [...] put') is embedded
in the PS file, so single page files except the first page do not include such info (A BUG, I GUESS!). This can be
salvaged if one can manually add bach such info. For b/w (such as document only) PS file, there should
be no such problem.

An example utility for this purpose can be found on lobster.caps.ou.edu:~fkong/bin/ps2eps_refl,
    ps2eps_refl infile.ps <page number> outfile
It convert the specified page (by 'page number') into eps file with correct color info. Before running it,
the color map info of the infile.ps should be copy to a separate file (e.g., color_refl) in the same directory.
ps2eps_* restores the color map info to the individual page PS (or eps) file.

Merge Two Images Side-by-Side (Left-to-Right)


Use +append option with convert command to join (merge) two images side-by-side into one single image file.
    convert +append image1.gif image2.gif outimage.gif
(One can use -append to merge images top-to-bottom)