|
Extract graphics from pdf and print bad quality
Message-ID:<dmhc45r2ow.fsf@luke.ifi.uio.no>
Subject:Extract graphics from pdf and print: bad quality
Date:Sun, 11 Jan 2009 21:46:23 +0100
I have a pdf file which was generated from a scanner. I really need
the graphics and therefore used pdfimages (Linux) to get the graphics
as pbm files. These were larges than my A4 page: 2480x3507. I then used
Imagemagick's convert tool to get a normal 595x841 bitmap graphic, but
the quality was bad, almost not readable. (I tried a lot of options,
all possible filters, trying to resize with 25% which naively should
be "perfect" and so on. But no...)
However, when looking at the original pdf file in, say, xpdf, it is
very good. Printing is perfect.
So the big question is: How does xpdf and its friends resize the
images inside a pdf file so it looks so nice?
--
Jon Haugsand
Dept. of Informatics, Univ. of Oslo, Norway, mailto:jonhaug@ifi.uio.no
http://www.ifi.uio.no/~jonhaug/, Phone: +47 45 00 39 94
Message-ID:<slrngmlgv1.ts1.derekn@glyphandcog.com>
Subject:Re: Extract graphics from pdf and print: bad quality
Date:Mon, 12 Jan 2009 05:15:30 +0100
On 2009-01-11, Jon Haugsand <jonhaug@ifi.uio.no> wrote:
> I have a pdf file which was generated from a scanner. I really need
> the graphics and therefore used pdfimages (Linux) to get the graphics
> as pbm files. These were larges than my A4 page: 2480x3507. I then used
> Imagemagick's convert tool to get a normal 595x841 bitmap graphic, but
> the quality was bad, almost not readable. (I tried a lot of options,
> all possible filters, trying to resize with 25% which naively should
> be "perfect" and so on. But no...)
>
> However, when looking at the original pdf file in, say, xpdf, it is
> very good. Printing is perfect.
>
> So the big question is: How does xpdf and its friends resize the
> images inside a pdf file so it looks so nice?
Xpdf doesn't do anything exotic when it scales images. Something like
pnmscale (which will generate a PGM file as output) should give you
very similar results. I haven't used Imagemagick much, but I'd be
surprised if it can't do the same thing.
If you're trying to get 1-bit monochrome output (not 8-bit grayscale),
I kind of doubt that a 72 dpi image will look good, no matter what you
use.
- Derek
Message-ID:<dmd4etqaxt.fsf@luke.ifi.uio.no>
Subject:Re: Extract graphics from pdf and print: bad quality
Date:Mon, 12 Jan 2009 07:45:50 +0100
"Derek B. Noonburg" <derekn@glyphandcog.com> writes:
>
> Xpdf doesn't do anything exotic when it scales images. Something like
> pnmscale (which will generate a PGM file as output) should give you
> very similar results. I haven't used Imagemagick much, but I'd be
> surprised if it can't do the same thing.
>
> If you're trying to get 1-bit monochrome output (not 8-bit grayscale),
> I kind of doubt that a 72 dpi image will look good, no matter what you
> use.
Seems I am fooling around with pbm too much. Thanks. (I still don't
get the same quality as xpdf, but as this isn't a pdf issue, I change
group to ask in.)
--
Jon Haugsand
Dept. of Informatics, Univ. of Oslo, Norway, mailto:jonhaug@ifi.uio.no
http://www.ifi.uio.no/~jonhaug/, Phone: +47 45 00 39 94
Message-ID:<gkigqs$6l4$1@canard.ulcc.ac.uk>
Subject:Re: Extract graphics from pdf and print: bad quality
Date:Tue, 13 Jan 2009 17:51:38 +0100
Jon Haugsand wrote:
> I have a pdf file which was generated from a scanner. I really need
> the graphics and therefore used pdfimages (Linux) to get the graphics
> as pbm files. These were larges than my A4 page: 2480x3507. I then used
> Imagemagick's convert tool to get a normal 595x841 bitmap graphic, but
> the quality was bad, almost not readable. (I tried a lot of options,
> all possible filters, trying to resize with 25% which naively should
> be "perfect" and so on. But no...)
You've got a misunderstanding about the relationship of image dimensions
in pixels to page sizes. It doesn't make sense to say a particular image
is larger or smaller than an A4 page - an image of this sort has no intrinsic
physical dimensions. In this case, the number of pixels corresponds
very closely to what a scanner would produce if the page was scanned at
300 dpi (which would be a typical resolution one would use to get faithful
reproduction of printed text and graphics.) If you then print the image
at 300dpi, you will get an A4 page.
Why do you say that 595x841 is 'normal' - I see nothing 'normal' about
that in relation to an A4 page, although it corresponds quite closely to 72dpi,
which was once a typical screen resolution. But you are throwing away almost all
the quality if you resize the image to those dimensions.
If you want to print these images as A4, retain all the pixels and don't
try to resize them. Non-integer scaling will produce very undesirable
results.
>
> However, when looking at the original pdf file in, say, xpdf, it is
> very good. Printing is perfect.
>
> So the big question is: How does xpdf and its friends resize the
> images inside a pdf file so it looks so nice?
>
The only time xpdf will be doing resizing is when it is showing you
the page on your screen, when it will be resampling the image
from its native resolution to whatever screen resolution is needed.
I don't know offhand what algorithm it is using to do that, but it
isn't always pretty.
--
Kevin Ashley This is not a signature
Head of Digital Archives
ULCC http://dablog.ulcc.ac.uk/
Message-ID:<dmhc45r2ow.fsf@luke.ifi.uio.no>
Subject:Extract graphics from pdf and print: bad quality
Date:Sun, 11 Jan 2009 21:46:23 +0100
I have a pdf file which was generated from a scanner. I really need
the graphics and therefore used pdfimages (Linux) to get the graphics
as pbm files. These were larges than my A4 page: 2480x3507. I then used
Imagemagick's convert tool to get a normal 595x841 bitmap graphic, but
the quality was bad, almost not readable. (I tried a lot of options,
all possible filters, trying to resize with 25% which naively should
be "perfect" and so on. But no...)
However, when looking at the original pdf file in, say, xpdf, it is
very good. Printing is perfect.
So the big question is: How does xpdf and its friends resize the
images inside a pdf file so it looks so nice?
--
Jon Haugsand
Dept. of Informatics, Univ. of Oslo, Norway, mailto:jonhaug@ifi.uio.no
http://www.ifi.uio.no/~jonhaug/, Phone: +47 45 00 39 94
Message-ID:<slrngmlgv1.ts1.derekn@glyphandcog.com>
Subject:Re: Extract graphics from pdf and print: bad quality
Date:Mon, 12 Jan 2009 05:15:30 +0100
On 2009-01-11, Jon Haugsand <jonhaug@ifi.uio.no> wrote:
> I have a pdf file which was generated from a scanner. I really need
> the graphics and therefore used pdfimages (Linux) to get the graphics
> as pbm files. These were larges than my A4 page: 2480x3507. I then used
> Imagemagick's convert tool to get a normal 595x841 bitmap graphic, but
> the quality was bad, almost not readable. (I tried a lot of options,
> all possible filters, trying to resize with 25% which naively should
> be "perfect" and so on. But no...)
>
> However, when looking at the original pdf file in, say, xpdf, it is
> very good. Printing is perfect.
>
> So the big question is: How does xpdf and its friends resize the
> images inside a pdf file so it looks so nice?
Xpdf doesn't do anything exotic when it scales images. Something like
pnmscale (which will generate a PGM file as output) should give you
very similar results. I haven't used Imagemagick much, but I'd be
surprised if it can't do the same thing.
If you're trying to get 1-bit monochrome output (not 8-bit grayscale),
I kind of doubt that a 72 dpi image will look good, no matter what you
use.
- Derek
Message-ID:<dmd4etqaxt.fsf@luke.ifi.uio.no>
Subject:Re: Extract graphics from pdf and print: bad quality
Date:Mon, 12 Jan 2009 07:45:50 +0100
"Derek B. Noonburg" <derekn@glyphandcog.com> writes:
>
> Xpdf doesn't do anything exotic when it scales images. Something like
> pnmscale (which will generate a PGM file as output) should give you
> very similar results. I haven't used Imagemagick much, but I'd be
> surprised if it can't do the same thing.
>
> If you're trying to get 1-bit monochrome output (not 8-bit grayscale),
> I kind of doubt that a 72 dpi image will look good, no matter what you
> use.
Seems I am fooling around with pbm too much. Thanks. (I still don't
get the same quality as xpdf, but as this isn't a pdf issue, I change
group to ask in.)
--
Jon Haugsand
Dept. of Informatics, Univ. of Oslo, Norway, mailto:jonhaug@ifi.uio.no
http://www.ifi.uio.no/~jonhaug/, Phone: +47 45 00 39 94
Message-ID:<gkigqs$6l4$1@canard.ulcc.ac.uk>
Subject:Re: Extract graphics from pdf and print: bad quality
Date:Tue, 13 Jan 2009 17:51:38 +0100
Jon Haugsand wrote:
> I have a pdf file which was generated from a scanner. I really need
> the graphics and therefore used pdfimages (Linux) to get the graphics
> as pbm files. These were larges than my A4 page: 2480x3507. I then used
> Imagemagick's convert tool to get a normal 595x841 bitmap graphic, but
> the quality was bad, almost not readable. (I tried a lot of options,
> all possible filters, trying to resize with 25% which naively should
> be "perfect" and so on. But no...)
You've got a misunderstanding about the relationship of image dimensions
in pixels to page sizes. It doesn't make sense to say a particular image
is larger or smaller than an A4 page - an image of this sort has no intrinsic
physical dimensions. In this case, the number of pixels corresponds
very closely to what a scanner would produce if the page was scanned at
300 dpi (which would be a typical resolution one would use to get faithful
reproduction of printed text and graphics.) If you then print the image
at 300dpi, you will get an A4 page.
Why do you say that 595x841 is 'normal' - I see nothing 'normal' about
that in relation to an A4 page, although it corresponds quite closely to 72dpi,
which was once a typical screen resolution. But you are throwing away almost all
the quality if you resize the image to those dimensions.
If you want to print these images as A4, retain all the pixels and don't
try to resize them. Non-integer scaling will produce very undesirable
results.
>
> However, when looking at the original pdf file in, say, xpdf, it is
> very good. Printing is perfect.
>
> So the big question is: How does xpdf and its friends resize the
> images inside a pdf file so it looks so nice?
>
The only time xpdf will be doing resizing is when it is showing you
the page on your screen, when it will be resampling the image
from its native resolution to whatever screen resolution is needed.
I don't know offhand what algorithm it is using to do that, but it
isn't always pretty.
--
Kevin Ashley This is not a signature
Head of Digital Archives
ULCC http://dablog.ulcc.ac.uk/
Message-ID:<dmhc45r2ow.fsf@luke.ifi.uio.no>
Subject:Extract graphics from pdf and print: bad quality
Date:Sun, 11 Jan 2009 21:46:23 +0100
I have a pdf file which was generated from a scanner. I really need
the graphics and therefore used pdfimages (Linux) to get the graphics
as pbm files. These were larges than my A4 page: 2480x3507. I then used
Imagemagick's convert tool to get a normal 595x841 bitmap graphic, but
the quality was bad, almost not readable. (I tried a lot of options,
all possible filters, trying to resize with 25% which naively should
be "perfect" and so on. But no...)
However, when looking at the original pdf file in, say, xpdf, it is
very good. Printing is perfect.
So the big question is: How does xpdf and its friends resize the
images inside a pdf file so it looks so nice?
--
Jon Haugsand
Dept. of Informatics, Univ. of Oslo, Norway, mailto:jonhaug@ifi.uio.no
http://www.ifi.uio.no/~jonhaug/, Phone: +47 45 00 39 94
Message-ID:<slrngmlgv1.ts1.derekn@glyphandcog.com>
Subject:Re: Extract graphics from pdf and print: bad quality
Date:Mon, 12 Jan 2009 05:15:30 +0100
On 2009-01-11, Jon Haugsand <jonhaug@ifi.uio.no> wrote:
> I have a pdf file which was generated from a scanner. I really need
> the graphics and therefore used pdfimages (Linux) to get the graphics
> as pbm files. These were larges than my A4 page: 2480x3507. I then used
> Imagemagick's convert tool to get a normal 595x841 bitmap graphic, but
> the quality was bad, almost not readable. (I tried a lot of options,
> all possible filters, trying to resize with 25% which naively should
> be "perfect" and so on. But no...)
>
> However, when looking at the original pdf file in, say, xpdf, it is
> very good. Printing is perfect.
>
> So the big question is: How does xpdf and its friends resize the
> images inside a pdf file so it looks so nice?
Xpdf doesn't do anything exotic when it scales images. Something like
pnmscale (which will generate a PGM file as output) should give you
very similar results. I haven't used Imagemagick much, but I'd be
surprised if it can't do the same thing.
If you're trying to get 1-bit monochrome output (not 8-bit grayscale),
I kind of doubt that a 72 dpi image will look good, no matter what you
use.
- Derek
Message-ID:<dmd4etqaxt.fsf@luke.ifi.uio.no>
Subject:Re: Extract graphics from pdf and print: bad quality
Date:Mon, 12 Jan 2009 07:45:50 +0100
"Derek B. Noonburg" <derekn@glyphandcog.com> writes:
>
> Xpdf doesn't do anything exotic when it scales images. Something like
> pnmscale (which will generate a PGM file as output) should give you
> very similar results. I haven't used Imagemagick much, but I'd be
> surprised if it can't do the same thing.
>
> If you're trying to get 1-bit monochrome output (not 8-bit grayscale),
> I kind of doubt that a 72 dpi image will look good, no matter what you
> use.
Seems I am fooling around with pbm too much. Thanks. (I still don't
get the same quality as xpdf, but as this isn't a pdf issue, I change
group to ask in.)
--
Jon Haugsand
Dept. of Informatics, Univ. of Oslo, Norway, mailto:jonhaug@ifi.uio.no
http://www.ifi.uio.no/~jonhaug/, Phone: +47 45 00 39 94
Message-ID:<gkigqs$6l4$1@canard.ulcc.ac.uk>
Subject:Re: Extract graphics from pdf and print: bad quality
Date:Tue, 13 Jan 2009 17:51:38 +0100
Jon Haugsand wrote:
> I have a pdf file which was generated from a scanner. I really need
> the graphics and therefore used pdfimages (Linux) to get the graphics
> as pbm files. These were larges than my A4 page: 2480x3507. I then used
> Imagemagick's convert tool to get a normal 595x841 bitmap graphic, but
> the quality was bad, almost not readable. (I tried a lot of options,
> all possible filters, trying to resize with 25% which naively should
> be "perfect" and so on. But no...)
You've got a misunderstanding about the relationship of image dimensions
in pixels to page sizes. It doesn't make sense to say a particular image
is larger or smaller than an A4 page - an image of this sort has no intrinsic
physical dimensions. In this case, the number of pixels corresponds
very closely to what a scanner would produce if the page was scanned at
300 dpi (which would be a typical resolution one would use to get faithful
reproduction of printed text and graphics.) If you then print the image
at 300dpi, you will get an A4 page.
Why do you say that 595x841 is 'normal' - I see nothing 'normal' about
that in relation to an A4 page, although it corresponds quite closely to 72dpi,
which was once a typical screen resolution. But you are throwing away almost all
the quality if you resize the image to those dimensions.
If you want to print these images as A4, retain all the pixels and don't
try to resize them. Non-integer scaling will produce very undesirable
results.
>
> However, when looking at the original pdf file in, say, xpdf, it is
> very good. Printing is perfect.
>
> So the big question is: How does xpdf and its friends resize the
> images inside a pdf file so it looks so nice?
>
The only time xpdf will be doing resizing is when it is showing you
the page on your screen, when it will be resampling the image
from its native resolution to whatever screen resolution is needed.
I don't know offhand what algorithm it is using to do that, but it
isn't always pretty.
--
Kevin Ashley This is not a signature
Head of Digital Archives
ULCC http://dablog.ulcc.ac.uk/
|