Bug 6984

Summary: pdfimages: not working
Product: poppler Reporter: Rainer Keller <class321>
Component: generalAssignee: poppler-bugs <poppler-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high Keywords: patch
Version: unspecified   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: patch for bug 6984

Description Rainer Keller 2006-05-20 19:32:35 UTC
1. The command line tool "pdfimages" is not working at all. No images will be 
written to disk because the ImageOutputDev is designated as non graphic device.

2. The ppm creation is not correct and results into rainbow colored pictures.

3. The following patch should fix this.


diff -u -r poppler-0.5.1/utils/ImageOutputDev.cc 
poppler-0.5.1patched/utils/ImageOutputDev.cc
--- poppler-0.5.1/utils/ImageOutputDev.cc 2006-01-23 16:24:36.000000000 +0100
+++ poppler-0.5.1patched/utils/ImageOutputDev.cc  2006-05-20 11:20:28.000000000 
+0200
@@ -184,9 +184,9 @@
       p = imgStr->getLine();
       for (x = 0; x < width; ++x) {
  colorMap->getRGB(p, &rgb);
- fputc((int)(rgb.r * 255 + 0.5), f);
- fputc((int)(rgb.g * 255 + 0.5), f);
- fputc((int)(rgb.b * 255 + 0.5), f);
+ fputc((int)(255.0 / 65536.0 * rgb.r), f);
+ fputc((int)(255.0 / 65536.0 * rgb.g), f);
+ fputc((int)(255.0 / 65536.0 * rgb.b), f);
  p += colorMap->getNumPixelComps();
       }       
     }
diff -u -r poppler-0.5.1/utils/ImageOutputDev.h 
poppler-0.5.1patched/utils/ImageOutputDev.h
--- poppler-0.5.1/utils/ImageOutputDev.h  2005-12-12 19:57:13.000000000 +0100
+++ poppler-0.5.1patched/utils/ImageOutputDev.h 2006-05-20 11:20:34.000000000 
+0200
@@ -45,7 +45,7 @@
   virtual GBool interpretType3Chars() { return gFalse; }
 
   // Does this device need non-text content?
-  virtual GBool needNonText() { return gFalse; }
+  virtual GBool needNonText() { return gTrue; }
 
   //---- get info about output device
Comment 1 Rainer Keller 2006-05-20 19:34:12 UTC
Created attachment 5697 [details] [review]
patch for bug 6984
Comment 2 Kristian Høgsberg 2006-05-23 05:59:11 UTC
Thanks committed, though I changed the rgb to byte conversion to use colToByte()
instead.

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.