IRC Logs

Log of #ghostscript at irc.freenode.net.

Search:
 <<<Back 1 day (to 2016/06/08)20160609 
psmlbhor Hello. I have some PWG raster files which I am converting to Postscript files using colorimage command and writing the data in hex format. But the output files produces are 500 MB in size. Is there any way I can reduce the size of PS files ?04:55.02 
  can anyone help me please?06:55.05 
kens Its not yet 8 am here in the UK and its the middle of hte night in the US.06:55.38 
psmlbhor Oh! Sorry I didn't thought about that. I will wait06:56.39 
  kens, can you help me with that?06:57.07 
kens I've just read your question and I don't see what you are expecting. A bitmap file has a lot of pixels in it, so its always going to be large.06:57.44 
  You can, of course, apply compression and then write the PostScript to apply a decompression filter.06:58.00 
  Using binary instead of hex string would also reduce the size considerably06:58.22 
psmlbhor but won't binary occupy 4 times the space for each hex character?07:00.38 
kens Well no07:02.17 
  0xFF is one binary byte, in hex its 2 bytes07:02.52 
psmlbhor ok. I will try this out now. Thanks07:05.11 
halabund Are there any free PostScript viewers based on Ghostscript for OS X?08:14.04 
kens Yes, Ghostscript08:14.13 
halabund I’m using gv, which is X based. Anything better?08:14.15 
  h08:14.20 
kens I guess you need to define 'better'08:14.36 
  Ghostscript itself will render to an X terminal window, gv is kind of old, and I'm not really familiar with it08:15.13 
halabund kens: I would like the ability to zoom, pan and hopefully not be X based. Otherwise I’ll just stick to gv.08:15.29 
kens Well, one of our developers wrote a (ground up) new version of GSView, but I don't remember if it runs on a Mac.08:16.23 
  Seems it exists:08:17.32 
  http://www.gsview.com/downloads.html08:17.32 
  There's an OS/X link there. I've no idea about it's capabilities though08:17.55 
  One thing you might need to bear in mind is that it uses GS to convert PostScript to PDF, and tehn views the PDF08:18.18 
halabund Thank you! There probably isn’t anything better for Mac then, except paid solutions. Preview usually opens EPS files so most people don’t need it. And otherwise they’d convert to PDF with another tool than Preview and view the PDF anyway.08:18.29 
  Ah, sorry08:18.49 
  I thought I was looking at the same link08:18.54 
  this is something different08:18.57 
kens Yeah, up to version 6 GSView is a Linux/WIndows thing (mainly Windows) by Russell Lang of Ghostgum08:19.32 
  THe new version is ours, but it works differntly08:19.47 
ferter hi! may i ask you, if saving password-protected pdf is somewhat different from saving ordinary files in mupdf? 08:20.52 
kens ferter you want to take a PDF and add a password to it, or take an existing secured PDF and save changes ? I can't answer either way I'm afraid, but it'll save time when someone comes along who can answer08:21.52 
ferter i have an existing secured PDF. when i add annotations and to save them, AP won't work properly when i reopen a saved file. this bug appears ONLY with secured files, i've checked that carefully!08:24.06 
halabund kens: Thanks! GSview 6 does what I need.08:24.09 
kens Ah good, hope it helps you out08:24.19 
halabund (Illustrator doesn’t though, it doesn’t put the a bounding box that corresponds to the artboard in the EPS.)08:24.33 
kens I guess the problem is which Box to use when creating an EPS, MediaBox, BleedBox, TrimBox, CropBox, ArtBox.....08:25.19 
  ferter I recently discovered that saving a repaired file didn't actually repair the file, this may be a related problem.08:25.45 
  Hopefully Robin_Watts will be able to say more when he comes online08:26.15 
ferter kens, ok thank you. what is a repaired file, though?)08:26.40 
kens ah, if a PDF file is invalid in some way (eg the xref table is incorrect) MuPDF will repair the fault. It then offers to save the repaired file. However that doesn't seem to work now (it did). I'm speculating that there may be a similar problem affecting secured files, because a modified file has new objects, and the encryption key uses the object numbers. So it may be that rewriting PDF files has some kind of problem similar to the repair b08:29.11 
kens hunts more coffee08:30.01 
ferter all right, gotcha08:34.33 
kens Of course, it may simply be that the PDF rewriting code doesn't support encrypted files, for the reason that the new object(s) number need to be encrypted. I don't know enough about MuPDF, but someone will be able to answer shortly I expect08:35.54 
ferter hope so)08:41.32 
Robin_Watts ferter: MuPDF can't write encrypted files.09:10.47 
  It *should* allow you to save files without encryption once you've added stuff, but it's possible that yesterdays bug might be biting us there too.09:12.14 
ferter Robin_Watts thank you for the feedback09:32.33 
Robin_Watts ferter: If you open a bug, and attach a file before and after adding AP's, I'll have a look.09:33.01 
  It may be I need to tweak the pdf_can_be_saved_incrementally function a bit more.09:33.18 
ferter Robin_Watts i will do it, if it helps. but i don't now how09:34.24 
Robin_Watts Go to bugs.ghostscript.com. It's all obvious.09:34.39 
ferter Robin_Watts done09:48.12 
Robin_Watts thanks. Give ma a couple of days..09:48.55 
ferter you are welcome, sir10:04.00 
halabund If I use -r600 with eps2write, while converting a PDF, will it resample higher resolution bitmaps to 600 dpi? I need everything to be at most 600 dpi, no higher resolution.10:55.45 
kens Not by default10:56.02 
  You can use the relevant controls to set the image resolution threshold and downsample type though10:56.25 
  See VectorDevices.htm in /ghostpdl/doc in the current release10:57.07 
  BTW setting -r600 only affects the resolution of objects which Ghostscript renders. SO if the input was a PDF with transparency, the output would be an image at the specified resolution. Other images, and the accuracy of vector objects, are not affected by '-r'10:58.50 
halabund BTW is it true that using higher resolution can cause a bad quality output?10:59.25 
  Because that’s what the journal told me. That it mustn’t be higher than 600 dpi or it will look bad. I don’t understand how that is possible.10:59.47 
kens It should not, no. But its not clear to me what you mean by 'bad quality'10:59.52 
Robin_Watts halabund: If you have images at 800 dpi, and then they actually get rendered at 600dpi, then depending on the techniques they use, you might get dropout.11:00.36 
kens If you are printing at 600 dpi, and the input is higher resolution than that, then the input obviously will be reduced, and the method used is device-dependent. SO it depends what is being used to do the job.11:00.41 
Robin_Watts This will be especially noticeable with halftoned images (images that are halftoned in your source document)11:01.04 
halabund To quote, they said “Images in Figures 1-4 and 6-11 are high resolution and may not look good when published.” “Please carefully review the Figure Guidelines and ensure that any images placed within your Figures do not exceed 600 dpi”11:01.34 
kens Well, its like Robin said. COnsider a 1 pixel horizontal line at 1200 dpi. WHen we print that at 600 dpi, using a simple solution like subsampling, its possible the entire horizontal line might be dropped.11:02.31 
halabund OK, second question: is it possible to use Ghostscript to get rid of all transparency in a PDF (and then output EPS)? It will be completely acceptable to just set the opacity of any transparent objects to 1 (fully opaque).11:03.19 
  I don’t expect it will be possible ...11:03.26 
kens Using a better 'but more computationally intensive) downsampling algorithm would perhaps change the 1 pixel black line into a 1 pixel gray line instead11:03.33 
halabund â€¦ but I wanted to ask as it would save me some time.11:03.35 
kens If you have a transparent PDF as input, and convert to PostScript, there will be no transparency. However, the result will be that the pages ocontaining transparency will be rendered to bitmap images. THis may well not be aqcceptable toyou.11:04.22 
  You can also (I think) set -dNoTransparency, which will drop all transparency (effectiverly setting it to fully opaque), which will (again, I think) produce an EPS without any transparency, but not rendered to a bitmap.11:05.19 
  You'd have to try that and check it though, I'm not certain11:05.31 
  Apparently that should be -dNOTRANSPARENCY11:06.26 
halabund Thanks! It sounds like I need -dNoTransparency. I’ll try it. The goal is to avoid rasterization. My plotting software tends to put in unnecessarily transparent lines.11:06.34 
kens Its not unusual, Cairo, for example, often adds irrelevant transparency operations11:07.08 
kens lunches11:12.30 
halabund OK, so I’m trying to get gs to downsample high res images embedded in a PDF, and output an EPS11:34.10 
  I use this:11:34.12 
  gs -sDEVICE=eps2write -r600 -sOutputFile=Fig11.eps -dBATCH -dNOPAUSE -dDownsampleColorImages=true -dColorImageResolution=600 Fig11.pdf11:34.31 
  It doesn’t seem to downsample though11:34.38 
  What am I missing?11:34.40 
  I also added -dColorImageDownsampleThreshold=1.0, but no effect11:37.33 
  is this because I am using eps2write instead of pdfwrite? Are these specific to pdfwrite?11:37.49 
Robin_Watts halabund: You will need to wait for kens to get back from lunch.11:39.09 
halabund In case I accidentally disconnect, I am going to check the channel logs!11:41.38 
kens is back, let me catch up11:44.47 
  The parameters are not specific to pdfwrite, we do use them for ps2write and eps2write as well,though I appreciate this may be confusing.11:45.41 
  Its one of the reasons I rewroter the documentation.11:45.55 
  Well, if you set DownsampleColorImages, ColorImageDownsampleThreshold and ColorImageResolution, it *ought* to work as far as I can see.11:47.35 
  If you have an example file you can share I can look further, otherwise I'll try and find one here.11:48.00 
halabund I’ll share it11:49.07 
kens Saves me rummaging through PDF files, thanks11:50.21 
halabund I’m using 9.19 from MacPorts btw.11:55.01 
kens halabund : it looks like there might be a big here. When we try to decide whether to downsample or not the pointer tot he CTM is always NULL. Without knowing the CTM we can't work out the effective resolution of the image, so we don't know that we should downsample it.12:03.45 
halabund what is the CTM?12:04.16 
kens Current Transformation Matrix12:04.24 
  Its the method for converting between user space (infinitely scalable) and device space (real pixels)12:04.50 
  We need to know how what the DPI of the image is before we can decide whether to downscale or not. We do that by finding out how much of the page it covers and then dividing by the number of pixels in each direction in the image data.12:05.41 
  But we need the CTM to figure out how big the image is, and we don't have it. THat seems to be a bug, and I'm sure this worked previously :-(12:06.06 
halabund Is there anything I can do while producing the file to make it more likely that I won’t hit this problem? If not, it’s no big deal, I’ll just take a ruler, measure and approximate how many pixels I should use.12:06.34 
kens There's nothing you can do, this is internal in the devioce code12:06.49 
halabund OK12:06.53 
  Thanks for looking at it :-)12:07.01 
kens I'll carry on looking at it, I need to fix this if its a bug12:07.13 
  Its *supposed* to work :-(12:07.23 
  ah, it looks like the problem is that because its PostScript output, we do images inline, so we set 'lossless' filters, and that drops the graphics state. I expect I cna fix that. Looks like nobody ever tested this before.12:11.33 
  halabund I fixed the problem, but it seems that your images, as drawn, are not > 600 dpi. I'm getting a resolution of 391 dpi for the first, and 300 for teh second.12:21.42 
halabund @kens Thank you! I wasn’t sure they were 600 dpi, but I tried decreasing the setting all the way to 50 and the file size didn’t change. That’s why I was convinced that something is wrong.12:22.59 
kens Oh yes, there's definitely a bug as well, I've got a fix for that as well but I need to test it.12:23.31 
  With my fix changing from 600 dpi to 200 dpi drops the file size from 3.3MB to 1.27 MB so it seems like its working.12:25.39 
  Seems like ColorImageDownsample also isn't being set, need to fix that too12:27.09 
 Forward 1 day (to 2016/06/10)>>> 
ghostscript.com
Search: