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 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 - -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? |
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. |
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. |
Why not try using pdftoppm to get an image, then convert that with imagemagick ?
|
Quote:
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 Code:
convert document-000001.ppm -monochrome -threshold 80% -despeckle -density 200 -format fax document_g3fax.tiff |
All times are GMT -5. The time now is 07:52 PM. |