[Thread Prev][Thread Next][Index]

Produce gif,pdf in batch at specific size

Hi all,

Here is the way, I have managed the production of
plots in pdf or gif formats when I use ferret in batch
(no Xvfb needed).

Here is a typical ferret script:

yes? set win/as=`296/210` ! for a A4 paper portrait (210mmx296mm)
yes? set viewport full
yes? go margins 0.001,0.001,0.001,0.001 ! to plot boundaries of the viewport
yes? polygon/nolab/noaxes/line=1 {0,0,1,1,0},{0,1,1,0,0}
yes? go margins 3 3 1 1 ! margins are in inches
yes? use levitus_climatology
yes? shade temp[k=1]
yes? exit

Note that if you use :
- a script called page_new.jnl to set a page and view positions of predefined viewports at:
(download also viewport_show.jnl and viewport_borders.jnl from:
- a script called margins_set.jnl to set margins in pourcentage of the viewport at:

Then the previous script would then be written:
yes? go page_new -i 1 1
yes? set viewport 1
yes? go margins_set 30 30 20 20
yes? use levitus_climatology
yes? shade temp[k=1]
yes? exit

The postscript will be generated with: ferret -server -batch ex.ps < ex.jnl

The gif image will be generated with: ps2gif -o ex.gif ex.ps

The pdf image will be generated with: ps2pdf ex.ps ex.pdf

Those kshell scripts can be found at:

Convert a postscript file to a gif image file.

ps2gif is a shell script based on gs from http://www.cs.wisc.edu/~ghost,
pnmfile, pnmcrop, pnmflip from http://netpbm.sourceforge.net/ and
convert d'ImageMagick from http://www.imagemagick.org/.

The postscript is converted with gs to a pnmraw 24 bits image.
Then, the pnmraw 24 bits image is converted to a 8 bits gif image
using convert (compiled with the --enable-lzw=yes option).

ps ------> pnmraw -----------> pnmraw -----------> gif
(gs) (pnmcrop) (convert)

Convert postscript file(s) to pdf file(s).
ps2pdf is a shell script based on gs from http://www.cs.wisc.edu/~ghost.

ps ------> pdf


Hope that's help.


[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement