f



Best way to combine .g3 files into one ps/pdf file

I am using mgetty/sendfax to receive faxes.  By default, mgetty/sendfax
stores received faxes as individual image files for each page so that a
three page fax ends up as three separate .g3 files.

I'd like to combine those .g3 files into one ps or pdf file.  Any
suggestions on the best way to do this?

TIA,

--Kamus
0
yan (1424)
11/10/2004 4:27:56 PM
comp.os.linux.misc 33599 articles. 1 followers. amosa69 (78) is leader. Post Follow

7 Replies
774 Views

Similar Articles

[PageSpeed] 49

["Followup-To:" header set to comp.os.linux.misc.] On Wed, 10 Nov 2004
11:27:56 -0500, Kamus of Kadizhar staggered into the Black Sun and said:
> I am using mgetty/sendfax to receive faxes.  By default,
> mgetty/sendfax stores received faxes as individual image files for
> each page so that a three page fax ends up as three separate .g3
> files.
>
> I'd like to combine those .g3 files into one ps or pdf file.  Any
> suggestions on the best way to do this?

I'd do something like

convert file1.g3 file2.g3 file3.g3 ... fileN.g3 allfiles.tif

....to get a TIFF.  You might have to specify the size of each G3 file in
pixels to convert if it can't find it out on its own.  Then do

tiff2ps allfiles.tif
ps2pdf allfiles.ps

....although tiff2ps may not do exactly what you need by default, it has
a bunch of options you can use.  Also note that really old versions of
ImageMagick were slow at handling TIFFs and newer versions are better, so
if you've got an ImageMagick thats older than 5.5.2 or so, it's time to
upgrade.  HTH,

-- 
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin /    mail: TRAP + SPAN don't belong
http://www.brainbench.com     /                Hire me! 
-----------------------------/ http://crow202.dyndns.org/~mhgraham/resume
0
11/10/2004 5:55:21 PM
On Wed, 10 Nov 2004 17:55:21 +0000, Dances With Crows wrote:

> I'd do something like
> 
> convert file1.g3 file2.g3 file3.g3 ... fileN.g3 allfiles.tif
> 
> ...to get a TIFF.  You might have to specify the size of each G3 file in
> pixels to convert if it can't find it out on its own.  Then do
> 
> tiff2ps allfiles.tif
> ps2pdf allfiles.ps
> 
> ...although tiff2ps may not do exactly what you need by default, it has a
> bunch of options you can use.  Also note that really old versions of
> ImageMagick were slow at handling TIFFs and newer versions are better, so
> if you've got an ImageMagick thats older than 5.5.2 or so, it's time to
> upgrade.  HTH,

Hah!  thanks.  I seem to always forget about ImageMagick...

Do you know of any way to trick the assorted tiff2XX utils to read stdin? 
Seems that they all use a standard TIFF library, which errors out if using
stdin:

cat all.tif | fax2ps - > xxx.ps
TIFFOpen: -: Cannot open.
-: Can not open, or not a TIFF file.

Same error when using tiff2ps....

I'm trying to use this from within a script, and I'd rather not mess with
temp files....

--Kamus
0
yan (1424)
11/10/2004 7:35:31 PM
On Wed, 10 Nov 2004 14:35:31 -0500, Kamus of Kadizhar staggered into the
Black Sun and said:
> On Wed, 10 Nov 2004 17:55:21 +0000, Dances With Crows wrote:
>> I'd do something like
>> convert file1.g3 file2.g3 file3.g3 ... fileN.g3 allfiles.tif
>> 
>> ...to get a TIFF.  You might have to specify the size of each G3 file
>> in pixels to convert if it can't find it out on its own.  Then do
>> 
>> tiff2ps allfiles.tif && ps2pdf allfiles.ps
>> 
>> ...although tiff2ps may not do exactly what you need by default, it
>> has a bunch of options you can use.  Also note that really old
>
> Do you know of any way to trick the assorted tiff2XX utils to read
> stdin?

It's not possible for TIFF utilities to read stdin.  TIFF itself
requires a seekable file because of the format itself.  The first 8
bytes of a TIFF are a 4-byte magic number and a 4-byte file offset to
the TIFF directory.  TIFF libraries check the magic number, then seek to
the file offset and start reading the directory, which tells the library
how many tags there are, the values of each tag, and their positions in
the file.  stdin is not seekable, so all this falls apart.

> cat all.tif | fax2ps - > xxx.ps
> -: Can not open, or not a TIFF file.

Nope.  See above.

> I'm trying to use this from within a script, and I'd rather not mess
> with temp files....

Sorry, you can't do that here.  Just deal with it; temp files are easy
to rm -f when you're done.

-- 
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin /    mail: TRAP + SPAN don't belong
http://www.brainbench.com     /                Hire me! 
-----------------------------/ http://crow202.dyndns.org/~mhgraham/resume
0
11/10/2004 8:23:18 PM
On 2004-11-10, Kamus of Kadizhar <yan@NsOeSiPnAeMr.com> wrote:
> On Wed, 10 Nov 2004 17:55:21 +0000, Dances With Crows wrote:
>
>> I'd do something like
>> 
>> convert file1.g3 file2.g3 file3.g3 ... fileN.g3 allfiles.tif
>> 
>> ...to get a TIFF.  You might have to specify the size of each G3 file in
>> pixels to convert if it can't find it out on its own.  Then do
>> 
>> tiff2ps allfiles.tif
>> ps2pdf allfiles.ps
>> 
>> ...although tiff2ps may not do exactly what you need by default, it has a
>> bunch of options you can use.  Also note that really old versions of
>> ImageMagick were slow at handling TIFFs and newer versions are better, so
>> if you've got an ImageMagick thats older than 5.5.2 or so, it's time to
>> upgrade.  HTH,
>
> Hah!  thanks.  I seem to always forget about ImageMagick...
>
> Do you know of any way to trick the assorted tiff2XX utils to read stdin? 
> Seems that they all use a standard TIFF library, which errors out if using
> stdin:
>
> cat all.tif | fax2ps - > xxx.ps
> TIFFOpen: -: Cannot open.
> -: Can not open, or not a TIFF file.
>
> Same error when using tiff2ps....

fax2ps /proc/self/fd/0 >xxx.ps

-- 
Grant Edwards                   grante             Yow!  My vaseline is
                                  at               RUNNING...
                               visi.com            
0
grante (5416)
11/10/2004 8:30:26 PM
On 2004-11-10, Grant Edwards <grante@visi.com> wrote:

>> Do you know of any way to trick the assorted tiff2XX utils to read stdin? 
>> Seems that they all use a standard TIFF library, which errors out if using
>> stdin:
>>
>> cat all.tif | fax2ps - > xxx.ps
>> TIFFOpen: -: Cannot open.
>> -: Can not open, or not a TIFF file.
>>
>> Same error when using tiff2ps....
>
> fax2ps /proc/self/fd/0 >xxx.ps

I should add: while the above will fool a program into reading
from stdin, /proc/self/fd/0 doesn't act identically to a real
file (I don't think it's seekable), so it may still not work.

-- 
Grant Edwards                   grante             Yow!  I love FRUIT
                                  at               PICKERS!!
                               visi.com            
0
grante (5416)
11/10/2004 9:21:44 PM
On 10 Nov 2004 21:21:44 GMT, Grant Edwards staggered into the Black Sun
and said:
> On 2004-11-10, Grant Edwards <grante@visi.com> wrote:
>> fax2ps /proc/self/fd/0 >xxx.ps
> I should add: while the above will fool a program into reading from
> stdin, /proc/self/fd/0 doesn't act identically to a real file (I don't
> think it's seekable), so it may still not work.

fax2ps is linked to libtiff.  libtiff requires a seekable file to work
properly.  See Message-ID
slrncp4u5v.1k9.danSPANceswitTRAPhcrows@samantha.crow202.dyndns.org
for more information on why this is so.  Kamus is going to have to use
temporary files if he wants to use TIFF utilities to deal with these
things.

-- 
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin /    mail: TRAP + SPAN don't belong
http://www.brainbench.com     /                Hire me! 
-----------------------------/ http://crow202.dyndns.org/~mhgraham/resume
0
11/10/2004 9:37:31 PM
On Wed, 10 Nov 2004 17:55:21 +0000, Dances With Crows wrote:

> ["Followup-To:" header set to comp.os.linux.misc.] On Wed, 10 Nov 2004
> 11:27:56 -0500, Kamus of Kadizhar staggered into the Black Sun and said:
>> I am using mgetty/sendfax to receive faxes.  By default,
>> mgetty/sendfax stores received faxes as individual image files for
>> each page so that a three page fax ends up as three separate .g3
>> files.
>>
>> I'd like to combine those .g3 files into one ps or pdf file.  Any
>> suggestions on the best way to do this?
> 
> I'd do something like
> 
> convert file1.g3 file2.g3 file3.g3 ... fileN.g3 allfiles.tif
> 
> ...to get a TIFF.  You might have to specify the size of each G3 file in
> pixels to convert if it can't find it out on its own.  Then do
> 
> tiff2ps allfiles.tif
> ps2pdf allfiles.ps

FWIW, I have been using tiff2pdf to convert from composite .tiff files
(scanned pages concatenated with tiffcp) to .pdf output. Might save you a
step? Linux tiff-3.6.1-38.12 for SuSE 9.1 has this tiff2pdf command (but
the Solaris version of tiff does not?!?). If not there, then I guess you
have to use tiff2ps & ps2pdf.

If you do have tiff package that includes tiff2pdf, it might run faster
than the combination of tiff2ps and ps2pdf (supplied by
ghostscript-library in SuSE 9.1)?

I also thought there would be some easier and/or more efficient way to get
from .g3 to .tiff or .pdf but I guess ImageMagick is the most general
and/or universal image file format processing package. The g3utils package
only takes you to .pbm and then you still have to go thru .tiff format?

Ooh, look, the tiff package has /usr/bin/fax2ps! Dunno if that is general
enough? Now I'm getting confused. I guess tiff format includes (subset?)
of g3 format? Is that encapsulated somehow? It looks like they are close
enough that if I were to do a LOT of this kind of thing, I might try
adapting a one-step conversion using libtiff or something. Later... YMMV


> ...although tiff2ps may not do exactly what you need by default, it has
> a bunch of options you can use.  Also note that really old versions of
> ImageMagick were slow at handling TIFFs and newer versions are better, so
> if you've got an ImageMagick thats older than 5.5.2 or so, it's time to
> upgrade.  HTH,

....interesting...

-- 
Juhan Leemet
Logicognosis, Inc.

0
juhan (492)
11/11/2004 4:32:54 AM
Reply: