1

Edit: I've done some more investigation and can clarify the problem, I will leave the original question below too.

It seems that when using TIFF image data with multiple strips, pdfwrite produces an output PDF with one XObject per strip. In my case I have 25 rows per strip so the full page image is being broken up into 25-pixel high images. This would be fine except it produces unpleasant visual artefacts.

Using tiffcp to revert the file to one big strip fixes this, but Acrobat Distiller doesn't require this workaround as it maintains the image as one big XObject by default.

Can we make Ghostscript do the same?


I'm attempting to use pdfwrite instead of Acrobat Distiller to convert a PS file to PDF. The file contains many scanned TIFF images that are called with the GetTiff function (I think this was originally supplied by Xerox).

Distiller's output is fine but pdfwrite seems to produce multiple vertical XObjects for each image, instead of just one as Distiller does. They all appear as below in the PDF with the exact same size:

104 0 obj
<</Subtype/Image
/ImageMask true
/Width 2550
/Height 25
/BitsPerComponent 1/Length 7975>>stream

Is there a way to stop this behaviour? The output seems fine when zoomed in a huge amount, or when printed, but on screen at a regular zoom there are rendering artefacts at the boundary between images.

I've tried just a basic command line (no options except -sDEVICE and -sOutputFile) as well as a variety of image options but no difference so far. I've tried versions 9.05 and 8.54.

Nick P
  • 759
  • 5
  • 20

1 Answers1

2

Ghostscript won't consume a TIFF file directly so you must be doing something else with it. My suspicion would be that whichever tool you are using to convert to PostScript this one is producing multiple images. I don't know anything about the 'GetTiff' 'function', but I would be suspicious that this is the problem. Why not simply use libtiff ?

Adobe Acrobat distiller has a feature which 'concatenates' consecutive images if they are the same width and colour space, and contiguous.

pdfwrite doesn't do this.

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
KenS
  • 30,202
  • 3
  • 34
  • 51
  • I hadn't thought to try before, but tiff2ps does produce an image that looks correct with both methods. I won't be able to include it in our processes right now though, so converting the image with tiffcp is our solution. Acrobat stitching together certainly explains what is going on, and I think you're correct that it's GetTiff causing the problem - it's a function written in PS included in the file header, and I don't have the expertise yet to fully understand it. – Nick P Mar 12 '13 at 23:16
  • apologies for the atrocious spelling in my reply, I had just got off a trans-Atlantic flight and was obviously more tired than I thought! Here's a link to another SO answer you might find interesting too: http://stackoverflow.com/questions/15211428/conversion-tif-to-pdf-ghostscript – KenS Mar 13 '13 at 09:11
  • Thanks for that. In case you are curious (or anyone else seeing this cares) it seems GetTiff is included with some Xerox printers such as the DocuSP range, which we have a number of here. The copyright notice in our copy is from 1998 so it's been around for a while. – Nick P Mar 20 '13 at 02:26