Log of #ghostscript at irc.freenode.net.

Search:
 <<<Back 1 day (to 2019/08/22)Fwd 1 day (to 2019/08/24) >>>20190823 
icee mvrhel_laptop, Robin_Watts, pretty please00:07.10 
kens icee setting -dDEVICEWIDTHPOINTS (and -dDEVICEHIGHTPOINTS) alters the media aisze, but unless you set -dFIXEDMEDIA, the input file can override it setting the size can increase the media size as easily as decrease it. If you do set -dFIXEDMEDIA then the content is drawn at bottom left of the media (because in PDF 0,0 is at bottom left). In order to add white space you would use -c "<</PageOffset [x y]>> setpagedevice" -f where x07:27.17 
  and y are numbers expressed in points (1 inch = 72 points). You would want y=0 and x = whatever size you need.07:27.17 
  BTW please be aware that what you are doing isn't simply adding white space to your original PDF file. The original file is totally interpreted, to produce marking operations, which are then re-assembled into a completely new PDF file. The internals of which will not resemble the internals of your original PDF file. This can lead to a degradation in quality.07:28.47 
robtow I am experiencing some curious OCR errors on output from Ghostscirpt when internal scaling of an image is introduced. A simnple PDF with one included JPEG with a JPEG resolution of 520spi whas trouble when scalled to an output 300spi TIFF; but works fine when output as a 520spi TIFF. It also fails as 600 and 1200 spi TIFFs.17:51.35 
  Where can I find info about how Ghostscript 9.27 does internal scaling for an output device & resolution?17:52.36 
  I do have the source and have built it.17:52.45 
Robin_Watts robtow: What sort of errors are you seeing?17:59.06 
  PS and PDF both share an imaging model.17:59.32 
  For line art, if any part of an output pixel is touched, then the whole pixel is filled.17:59.58 
robtow I am seeing OCR errors from a consumer of the TIFF files. 18:00.16 
Robin_Watts For images, it's to do with the centre of the pixel being covered by the scaled image.18:00.22 
robtow The input PDF files are simple wrappers around a page image that is a JPEG. I have extracted the JPEG using pdfimages.18:00.49 
Robin_Watts so most of the time, if you have a PDF (or PS) file with a 520dpi image in it to a 300dpi image output, pixels will be dropped from the image.18:01.11 
robtow The JPEG has its internal rez as 520. If output to -r520 TIFF file, all is fine.18:01.34 
  if output to -r300 it fails.18:01.46 
  If I use Imagemagick convert to scale the jpeg and convert it to a 300spi TIFF all is well18:02.08 
Robin_Watts The OCR fails, presumably because of pixels having dropped out.18:02.11 
robtow I strongly suspect something funky with the image scaling internal to gs.18:02.26 
Robin_Watts If the PDF file says "Interpolate the image", then we do so.18:02.46 
robtow I also get errort when scaling UP to -r600.18:03.00 
Robin_Watts in which case you'll get no dropouts as such, just antialiasing.18:03.12 
  There is a command line flag you can use... just a mo...18:03.40 
robtow I used -dInterpolateControl=-1 to no avail.18:04.21 
Robin_Watts Ah. that was what I was going to suggest.18:04.48 
  Can you give me a file, and the exact command line you are using please?18:05.24 
robtow I cannot share the file, due to privacy concerns.18:05.51 
  command line - one of MANY:18:06.06 
  gs -dNOPAUSE -dBATCH -r300 -sDEVICE=tiff24nc -dInterpolateControl=-1 -sCompression=lzw -sOutputFile="Pic-%d.tif" whole_area.pdf18:06.11 
Robin_Watts Well, then I can't help you.18:06.27 
robtow Understood.18:06.37 
  I am pretty sure I exhausted the documentation, and variants such as -dGraphicsAlphaBits=418:07.23 
  So I am asking - where in the source is image scaling done?18:07.34 
Robin_Watts siscale.c18:08.28 
robtow In any case, you won't have the particular OCR software as well, to look at the system results; the TIFF files look fine to the eye.18:08.30 
Robin_Watts base/siscale.c18:08.37 
robtow Ah. Thank-you.18:08.39 
Robin_Watts Good luck, you'll need it :)18:08.55 
  The algorithm used is that described in Graphics Gems 3.18:11.43 
robtow Ah Graphics Gems... I remebmer that from the 90's. And Mitchell filtering.18:11.54 
Robin_Watts That's the one.18:12.07 
robtow Robin_Watts... reading the code I see this comment:19:20.57 
  /* By default we use the mitchell filter, but if we are scaling down19:21.01 
  * (either on the horizontal or the vertical axis) then use the simple19:21.01 
  * interpolation filter for that axis. */19:21.01 
  Ids this correct - that downsampling an image internally only does:19:22.06 
  Interp_filter(double t)19:22.08 
  {19:22.09 
  if (t < 0)19:22.09 
  t = -t;19:22.09 
  if (t >= 1)19:22.09 
  return 0;19:22.09 
  return 1 + (2*t -3)*t*t;19:22.11 
  }19:22.13 
  If so, I am somewhat bemused.19:23.07 
rabesames Hello. This is my first time here, so please be gentle :)21:53.42 
  I have a PDF (https://app.box.com/s/mp029psi609cze97vwiymcd660gbwb5w) that when I pass to GhostScript to convert to TIF, the TIF does not contain the Amy Furuhashi signature on page 621:54.52 
  the GhostScript command I use is21:55.14 
  gswin32.exe -dNOPAUSE -dBATCH -dOLDSAFER -sDEVICE=tiffg4 -sOutputFile="C:\Temp\CD100C6229B3441CBBE3564E05381216x.tif" -r300 -I"c:\Projects\IHM\build\GhostScript" -dTextAlphaBits=4 -q -dGraphicsAlphaBits=4 -dDOINTERPOLATE -dDITHERPPI=300 -T -dBATCH -dBATCH "C:\Temp\Ken_Customer_Initial_Disclosure_2019_01_29_5c50b15ba83d7.pdf"21:55.41 
  an example of the output TIF with the signature missing is at https://app.box.com/s/sozapzwt5nizj0fbtvctsv0jdkafh93421:58.30 
  Adobe Acrobat is able to display the signature fine21:59.20 
  I've tried muPDF and it is able to display the signature fine21:59.40 
  and passing it to muPDF to output as a new PDF, and the new PDF is passed to GhostScript, GS is able to produce a TIF with the signature in it22:00.34 
  can anyone here provide any guidance? is this a bug in GhostScript?22:05.21 
  I am using the latest version of GS 9.2722:06.27 
  I tried it also in 9.20 with the same results22:06.49 
  I also tried it with GS 64-bit with the same results22:08.01 
 <<<Back 1 day (to 2019/08/22)Forward 1 day (to 2019/08/24)>>> 
ghostscript.com #mupdf
Search: