[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Using pic/groff/gs to produce gif/jpeg

From: Larry Kollar
Subject: Re: [Groff] Using pic/groff/gs to produce gif/jpeg
Date: Sat, 21 Oct 2006 23:15:01 -0400

David Griffiths wrote:

Hi, I'm new to pic/groff and I've been having some problems producing either gif or jpeg images using them. ....

Anyway I started out following some instructions here: http:// but the resulting command was very slow. Here are my findings as pasted from my internal blog. I wondered if they made sense or if I'm missing some simpler approach to the whole thing (btw I need the gs stage because using -T gif in groff produces very poor text, no antialiasing).

Yes, there's a far simpler approach. Use this command:

        groff -p -Thtml test > test.html

which is equivalent to:

        pic test | groff -Thtml > test.html

This renders your text as HTML, which probably won't do what you really want with the text unless you're using -man or -ms macros, but will render each picture, table, and equation as a PNG file. If all you need is the rasterized pictures, you're golden. :-)

Actually, now that I think about it, you probably need to use the -ms macros to get the pics to render properly. Either that, or edit your input file thus:

        # pic commands here

From my blog:

I missed the hint in the FAQ and after a bit of messing around got the following command to work:

pic test | groff | ps2eps | gs -dDEVICEHEIGHTPOINTS=1000 -q -r360 - dNOPAUSE -sDEVICE=pnm -sOutputFile=- - -c quit | pnmcrop | pnmscale 0.5 | ppmtogif > test.gif

I had to add the -dDEVICEHEIGHTPOINTS=1000 option because without that it chopped off the top of the picture.

Ah, looking at the referenced FAQ, it appears that your groff uses A4 paper size by default. To fix that temporarily, change "groff" in the above pipeline to "groff -P-pletter" -- you can also change it permanently by editing the .../groff/<version>/font/devps/DESC file to contain the line "papersize letter" and removing any other "papersize" line in the file.

Hope that helps!

Larry Kollar     k  o  l  l  a  r  @  a  l  l  t  e  l  .  n  e  t
Unix Text Processing: "UTP Revival"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]