Forwarded from: http://bugzilla.gnome.org/show_bug.cgi?id=331781 I have a graphic showing a low resolution image with graph axes superimposed, saved as both EPS and PDF. When I view either file with Evince, the graphic appears smoothed. When I view the PDF with Acroread, I can see the individual pixels. I have uploaded three files to demonstrate the problem (the PNG shows the graph as I want it to appear): http://www.magres.nottingham.ac.uk/~magill/pixels/pixels.png http://www.magres.nottingham.ac.uk/~magill/pixels/pixels.pdf http://www.magres.nottingham.ac.uk/~magill/pixels/pixels.eps I am using Gentoo Linux, fluxbox, evince 0.5.0, poppler-0.5.0-r5 (cairo) Steps to reproduce: 1. open pixels.eps 2. open pixels.pdf 3. compare to pixels.png Actual results: The image appears as a smooth gradient. The PDF shows a white border on the bottom and right edges of the image and colourbar. Expected results: see pixels.png - I expect to see individual pixels in the image, and no white border on the PDF. The PDF file displays as expected in Acroread. The EPS file appears correct if displayed with xv. I can confirm this is only reproducible with cairo backend.
Another test case attached to evince bug: http://bugzilla.gnome.org/show_bug.cgi?id=484340
another test case http://bugzilla.gnome.org/show_bug.cgi?id=509132 However I noticed that while acrobat reader and xpdf render these .pdf's correctly the macosx preview viewer also has the same problem.
Smoothing of low-res graphics is not always a bug. In the PDF spec (at least in version 1.7), there is a flag (called 'Interpolate') for each image which is supposed to control smoothing. It defaults to 'false', for no interpolation. On Fedora 8, (poppler 0.6.2.2, cairo 1.5.8, evince 2.20.2), this flag is ignored by evince, which renders all images as smoothed. Acroread (8.1.2_SU1) gets it right. I'm attaching 3 pdf files and screenshots showing acroread and evince with the 3 files open. -pixels.Imissing.pdf: Interpolate not specified (should be blocky) -pixels.Itrue.pdf: Interpolate=true (should be smoothed) -pixels.Ifalse.pdf: Interpolate=false (should be blocky) -acroread_interp_examples.png (Acroread gets it right) -evince_interp_examples.png (evince renders all as smoothed)
Created attachment 18252 [details] Example PDFs and screenshots from acroread and evince
Created attachment 26358 [details] [review] Use Interpolate flag to decide whether applying image interpolation during rendering poppler/CairoOutputDev.cc | 92 ++++++++++++++++++++++++++------------------ poppler/CairoOutputDev.h | 46 ++++++++++++--------- poppler/Gfx.cc | 47 +++++++++++++++++++--- poppler/OutputDev.cc | 16 +++++--- poppler/OutputDev.h | 12 +++-- poppler/SplashOutputDev.cc | 15 +++++-- poppler/SplashOutputDev.h | 11 +++-- utils/HtmlOutputDev.cc | 16 ++++---- utils/HtmlOutputDev.h | 6 +- utils/ImageOutputDev.cc | 20 +++++----- utils/ImageOutputDev.h | 11 +++-- 11 files changed, 183 insertions(+), 109 deletions(-)
Created attachment 26390 [details] [review] Use Interpolate flag to decide whether applying image interpolation during rendering (Updated) poppler/CairoOutputDev.cc | 92 ++++++++++++++++++++++++++------------------ poppler/CairoOutputDev.h | 46 ++++++++++++--------- poppler/Gfx.cc | 47 +++++++++++++++++++--- poppler/OutputDev.cc | 16 +++++--- poppler/OutputDev.h | 12 +++-- poppler/SplashOutputDev.cc | 15 +++++-- poppler/SplashOutputDev.h | 11 +++-- utils/HtmlOutputDev.cc | 16 ++++---- utils/HtmlOutputDev.h | 6 +- utils/ImageOutputDev.cc | 20 +++++----- utils/ImageOutputDev.h | 11 +++-- 11 files changed, 183 insertions(+), 109 deletions(-) Updated after rebasing from current master.
Some indentation is broken, eg in + if (obj1.isNull()) { + obj1.free(); + maskDict->lookup("I", &obj1); + } of @@ -3954,6 +3979,16 @@ void Gfx::doImage(Object *ref, Stream *str, GBool inlineImg) { You forgot to change PreScanOutputDev, PSOutputDev and ArthurOutputDev functions Adding -Woverloaded-virtual to your CXXFLAGS will help spotting this kind of errors, maybe we should add it to the default
(In reply to comment #7) > Adding -Woverloaded-virtual to your CXXFLAGS will help spotting this kind of > errors, maybe we should add it to the default Definitely
Created attachment 26711 [details] [review] Use Interpolate flag to decide whether applying image interpolation during rendering poppler/ArthurOutputDev.cc | 4 +- poppler/ArthurOutputDev.h | 4 +- poppler/CairoOutputDev.cc | 92 +++++++++++++++++++++++++------------------ poppler/CairoOutputDev.h | 46 ++++++++++++--------- poppler/Gfx.cc | 47 +++++++++++++++++++--- poppler/OutputDev.cc | 16 +++++--- poppler/OutputDev.h | 12 +++-- poppler/PSOutputDev.cc | 5 +- poppler/PSOutputDev.h | 5 +- poppler/PreScanOutputDev.cc | 11 +++-- poppler/PreScanOutputDev.h | 11 +++-- poppler/SplashOutputDev.cc | 15 +++++-- poppler/SplashOutputDev.h | 11 +++-- utils/HtmlOutputDev.cc | 16 ++++---- utils/HtmlOutputDev.h | 6 +- utils/ImageOutputDev.cc | 20 +++++----- utils/ImageOutputDev.h | 11 +++-- 17 files changed, 207 insertions(+), 125 deletions(-)
drawMaskedImage in PSOutputDev still has the wrong signature And you failed to update/set your copyright in all the touched files. Fixing that you can commit
Pushed to git master.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.