gnuplot / image (E)
not so FAQ |
After Plotting (No.2)How do I convert a figure into image formats like PNG ? An image format that gnuplot can generate directly is ppm and png. There are several ways of image format conversion. Here are some examples.
Netpbm (ppmtoXXX commands) is useful for automatic conversion. The Firstly display something with gnuplot, then dump that window with xwd. gnuplot> set yrange [-6:6] gnuplot> set hidden3d gnuplot> set isosample 40 gnuplot> splot x*sin(y) gnuplot> shell % xwd > screen.xwd % exit exit gnuplot> Open this “screen.xwd” with xv, Imagemagick (display command), or Gimp, and % xwdtopnm < screen.xwd | ppmtopng > screen.png This generates PNG too. The next PNG figure was made with this technique. ![]() With GhostScript you have to check what image formats your gs supports first. % gs -help GNU Ghostscript 5.10 (1998-12-17) Copyright (C) 1997 Aladdin Enterprises, Menlo Park, CA. All rights reserved. Usage: gs [switches] [file1.ps file2.ps ...] Most frequently used switches: (you can use # in place of =) -dNOPAUSE no pause after page | -q `quiet', fewer messages -g<width>x<height> page size in pixels | -r<res> pixels/inch resolution -sDEVICE=<devname> select device | -dBATCH exit after last file -sOutputFile=<file> select output file: - for stdout, |command for pipe, embed %d or %ld for page # Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PDF Available devices: x11 x11alpha x11cmyk x11gray2 x11mono ml600 npdl epag escpage lbp310 lbp320 lips2p lips3 lips4 lips4c lips4v lips4vc fmpr mjc180 mjc360 mjc720 mj500c pr150 jj100 bj10v bj10vh md5000 dmprt deskjet djet500 laserjet ..... Here is an explanation how to convert a PS file into jpeg with gs. % gs -dNOPAUSE -sDEVICE=jpeg -sOutputFile=test.jpg -q -dBATCH -g500x350 test.eps The command above should not be folded but in one-line. The JPEG format, as shown below, is mainly used for a photo image,
|