Discussion:
Best method to reduce pbm files for print
(too old to reply)
Jon Haugsand
2009-01-12 06:57:59 UTC
Permalink
I have a pdf file which solely consists of four scanned images. When
using xpdf to view and print, the result is acceptable. However, when
using tools to extract the images, scale them, convert to ps and then
print, the results are terrible. I therefore try to find the best
steps, i.e. the steps xpdf uses, to print the images.

The images are extracted with pdfimages which produces 2480x3507 pbm
files. These are to be converted into 595x841 files using tools
available on a Linux. (ImageMagick, pbm*, pnm* and pgm* tools. Gimp
is not practical as I have many files and would like to make scripts.)

The following does not produce graphics as good as xpdf:

pnmscale 0.23980610208155118 f.pbm > f.pgm
convert f.pgm f.pdf

Any suggestions?
--
Jon Haugsand
Dept. of Informatics, Univ. of Oslo, Norway, mailto:***@ifi.uio.no
http://www.ifi.uio.no/~jonhaug/, Phone: +47 45 00 39 94
Norbert Hahn
2009-01-12 16:27:37 UTC
Permalink
Post by Jon Haugsand
I have a pdf file which solely consists of four scanned images. When
using xpdf to view and print, the result is acceptable. However, when
using tools to extract the images, scale them, convert to ps and then
print, the results are terrible. I therefore try to find the best
steps, i.e. the steps xpdf uses, to print the images.
Let's see...
Post by Jon Haugsand
The images are extracted with pdfimages which produces 2480x3507 pbm
files.
You've got about 8 meg. pixels which are good to be printed on a
A4 page at 300 DPI. A4 is 210x297 mm, roughly US letter format.
Note that 300 DPI roughly equals the resolution of the eye.
Post by Jon Haugsand
These are to be converted into 595x841 files using tools
available on a Linux. (ImageMagick, pbm*, pnm* and pgm* tools. Gimp
is not practical as I have many files and would like to make scripts.)
This is 1/16 of the original information. Thus it should print
equally well on 50x73 mm.
Post by Jon Haugsand
pnmscale 0.23980610208155118 f.pbm > f.pgm
convert f.pgm f.pdf
Looking at http://netpbm.sourceforge.net/doc/pnmscale.html you'll find
that pnmscale is outdated and replaced by pamscale which might do a
better job at rescaling.

What size are you going to print your pictures?

Norbert
Jon Haugsand
2009-01-12 18:31:30 UTC
Permalink
Post by Norbert Hahn
Looking at http://netpbm.sourceforge.net/doc/pnmscale.html you'll find
that pnmscale is outdated and replaced by pamscale which might do a
better job at rescaling.
What size are you going to print your pictures?
As they were when scanned, but after some manipulation of them. (To
be specific, they are address labels, but for some reason, they does
not match the address label sheets we got. For some other reason, the
original addresses are not available without a bureaucratic tedious
process. However, I thought it would be quite easy to remove white
space from and insert white space into the pictures in order to get
them to match. There are around 40 sheets of paper I scanned.)

I.e. printed as A4 pictures.
--
Jon Haugsand
Dept. of Informatics, Univ. of Oslo, Norway, mailto:***@ifi.uio.no
http://www.ifi.uio.no/~jonhaug/, Phone: +47 45 00 39 94
Jon Haugsand
2009-01-12 19:09:40 UTC
Permalink
Post by Norbert Hahn
What size are you going to print your pictures?
Actually, what I really need to accomplish my task is to be able to
print my 2480x3507 pictures on an A4 PS printer, i.e. as 595x841
pictures. However, the ps driver in convert makes really bad PS files
for the printer.
--
Jon Haugsand
Dept. of Informatics, Univ. of Oslo, Norway, mailto:***@ifi.uio.no
http://www.ifi.uio.no/~jonhaug/, Phone: +47 45 00 39 94
Norbert Hahn
2009-01-13 09:52:55 UTC
Permalink
Post by Jon Haugsand
Post by Norbert Hahn
What size are you going to print your pictures?
Actually, what I really need to accomplish my task is to be able to
print my 2480x3507 pictures on an A4 PS printer, i.e. as 595x841
pictures. However, the ps driver in convert makes really bad PS files
for the printer.
Hm, I don't understand the need to reduce the size of the original A4
page to 595x841 dots. This number of dots is sufficent for printing a
single address label but not 16 of them on A4.

No matter how good or bad the data decimation from 2480x3507 to 595x841
is done, those 500.000 pixel cannot print well on full A4.

Norbert
d***@hehe.com
2009-01-13 13:55:24 UTC
Permalink
Hi Jon,
don't exactly know what you want to do.
Don't explain how you do whatever, 'cause it seems that it doesn't
work.
So we have to guess what you want to do
and if I guess it correctly, try to use
pnmtops -dpi=300 yourfile.pnm
without scaling anything.

Greets
Daniel
Jon Haugsand
2009-01-14 15:06:23 UTC
Permalink
Post by d***@hehe.com
Hi Jon,
don't exactly know what you want to do.
Don't explain how you do whatever, 'cause it seems that it doesn't
work.
So we have to guess what you want to do
and if I guess it correctly, try to use
pnmtops -dpi=300 yourfile.pnm
without scaling anything.
Thanks to you and Norbert Hahn. I do understand my question is
incomprehensable. I am no graphic expert (by any means).

Let me ask simple: Given a 2480x3507 pbm graphics file and a
Postscript printer (HP 2550 Laser printer), how would you print the
file so that it is meant to cover the complete A4 paper? (I know the
printer cannot print at the edges, but the file is white there
anyway.)

To print any file, I usually convert the file into Postscript using
tools like convert (ImageMagick), dvips, a2ps and so on, and then
sending the file to the printer using Linux/Cups lpr program.
However, in this case, convert produces terrible postscript and the
resulting print is blurred. If I, however, open the original pdf file
in xpdf, and print the file from here, the print is acceptable. It is
also acceptable to open the pbm file in Gimp and print from here.
--
Jon Haugsand
Dept. of Informatics, Univ. of Oslo, Norway, mailto:***@ifi.uio.no
http://www.ifi.uio.no/~jonhaug/, Phone: +47 45 00 39 94
Loading...