LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-17-2010, 07:05 AM   #1
gnuweenie
Member
 
Registered: Oct 2010
Posts: 35

Rep: Reputation: Disabled
Producing a good FAX image (using Ghostscript and ImageMagick)


Sometimes I have to send a FAX (as some recipients are about 20 years behind the times). Sometimes the document looks excellent on the screen, but what comes out the other end looks terrible. So I'm trying to come up with a way to produce the best quality FAX from a vector PDF (which is searchable with images and text). Part of the goal is to preview the fax in advance, so there are no surprises.

I start by converting the vector PDF to a raster (bitmap) postscript document:
Code:
pdf2ps document.pdf document.ps
I do that because ImageMagick does not handle vector PDFs well (while Ghostscript does handle it).

Then I use ImageMagick to display a FAX-converted representation:
Code:
convert document.ps -monochrome -threshold 80% -despeckle -resize "150x100%" -density 200 -format fax miff:- | display -
-monochrome -threshold 80% makes it a bi-level image.

-despeckle removes noisey dots if there were any colored backgrounds.

-resize "150x100%" compensates for the fact that the width of a FAX pixel is 1.5 times its height (this switch is absent on the actual file creation).

-density 200 FAXes are only 200 dpi. ImageMagick is not always smart about inferring parameters, so I do this to force ImageMagick to do the FAX format to spec.

In the end, I'm ending up with a very crappy image even though I started with a very high quality PDF. It was expected to look bad, but not as bad as what I'm ending up with. It's barely legible.

How can these steps above be improved?

Last edited by gnuweenie; 10-19-2010 at 09:59 AM. Reason: solved
 
Old 10-18-2010, 05:44 AM   #2
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292
Well, it would be nice if you could somehow describe how bad, or provide an example ?

I would try a different program, a specialized one, maybe:
http://sourceforge.net/projects/hylapex/
or search.
 
Old 10-18-2010, 10:25 AM   #3
gnuweenie
Member
 
Registered: Oct 2010
Posts: 35

Original Poster
Rep: Reputation: Disabled
I think my problem is font mismatching. When I convert to postscript using pdf2ps, the quality is lousy before I even use ImageMagick to convert to a FAX-like image. But when I take the postscript and convert back to a PDF, the PDF quality is excellent. This means that pdf2ps is too smart (that is, it seems to preserve the vector graphics, when it's raster that I need).

Installing more PostScript fonts is too painful. Debian tries to install nothing, and in fact proposes that I remove packages. So this is more evidence that going to postscript was a bad move. I'm guessing hylapex will not solve this, because it depends on a postscript library.

What would be more interesting is a way to convert from vector PDF to a raster image (a tiff, or a PDF containing just a bitmap). I prefer small dedicated single purpose tools, rather than some monolithic feature rich application. It's just not obvious to me how to get a raster image from a vector PDF.
 
Old 10-18-2010, 10:48 AM   #4
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292Reputation: 1292
Why not try using pdftoppm to get an image, then convert that with imagemagick ?
 
1 members found this post helpful.
Old 10-18-2010, 11:21 AM   #5
gnuweenie
Member
 
Registered: Oct 2010
Posts: 35

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by H_TeXMeX_H View Post
Why not try using pdftoppm to get an image, then convert that with imagemagick ?
That was a good call. I just installed xpdf-reader (to get the pdftoppm tool), and it seems to work well for feeding ImageMagick to get a good representation of the FAX quality. I played with letting pdftoppm do the dithering, and it was poor with images, so it's best to leave that to ImageMagick

If anyone else goes down this path, this is the approach to preview a PDF in FAX quality:
Code:
pdftoppm -r 200 document.pdf document
convert document-000001.ppm -monochrome -threshold 80% -despeckle -resize "150x100%" -density 200 -format fax miff:- | display -
Then to actually write the file for faxing, drop the resizing parameter:
Code:
convert document-000001.ppm -monochrome -threshold 80% -despeckle -density 200 -format fax document_g3fax.tiff

Last edited by gnuweenie; 10-18-2010 at 11:24 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HP 5610 All-in-one fax VOIP and unreliable fax transmission metallica1973 Linux - Hardware 3 02-10-2009 10:52 AM
How to setup fax function and email to fax satimis Linux - Server 3 03-29-2008 07:55 AM
Any good fax server to recommend? tkt Linux - Newbie 1 06-16-2006 11:27 PM
Any good image apps similar to PS? Fasn8n Linux - General 7 03-09-2006 02:41 AM
good backup image software? bobbens Linux - Software 7 01-20-2005 01:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration