Log of #ghostscript at irc.freenode.net.

Search:
 <<<Back 1 day (to 2017/08/22)20170823 
Badabing_ Is there a way to make GhostScript use Flate on JPEG2000 rather than re-encoding them to jpeg?05:52.23 
  well I came up with a behemoth of a command to get around the lack of JPEG200006:15.35 
  gswin64c -o output.pdf -q -dNOPROMPT -sDEVICE=pdfwrite -dAutoRotatePages=/None -dDetectDuplicateImages=true -dCompatibilityLevel=1.7 -c ".setpdfwrite << /ColorACSImageDict << /VSamples [ 1 1 1 1 ] /HSamples [ 1 1 1 1 ] /QFactor 0.08 /Blend 1 >> /ColorImageDownsampleType /Bicubic /ColorConversionStrategy /LeaveColorUnchanged >> setdistillerparams" -f input.pdf06:15.40 
  woops, I probably don't need the compatibiltylevel still in there, that was just a test06:15.55 
  gswin64c -o output.pdf -q -dNOPROMPT -sDEVICE=pdfwrite -dAutoRotatePages=/None -dDetectDuplicateImages=true -c ".setpdfwrite <</ColorACSImageDict <</QFactor 0.4 /HSamples [1 1 1 1] /VSamples [1 1 1 1] /Blend 1>> /GrayACSImageDict<</QFactor 0.4 /HSamples [1 1 1 1] /VSamples [1 1 1 1] /Blend 1>>>> setdistillerparams" -f input.pdf06:37.37 
kens Badabing_ you can simply set ColorImageFilter to /Flate to use that isntead of JPEG. JPEG2000 (as you probably know) is patent encumbered and requires a licecne for encoding, which is why it is not available as a compression option in the output from Ghostscript.07:03.46 
Badabing_ kens: I did that and the PDF ended up gigantic.07:12.10 
  This will only use Flate on the images that really need it07:12.21 
kens You command line doesn't seem to use Flate at all07:12.45 
  Maybe I missed it07:12.49 
Badabing_ it doesn't need to, it's a default parameter.07:12.56 
kens Hmmm, did I change that ? I thought the default was for jpeg07:13.19 
Badabing_ JPEG compression (the DCTEncode filter) is used for 8-bit images that have smooth color changes (low-frequency images). The parameters specified in the ColorACSImageDict or GrayACSImageDict dictionary are used to provide further control. JPEG typically provides greater compression than Flate, but is lossy (can lose information). Flate compression is used for all other images. Flate is a lossless compression method, so it is mo07:13.28 
  that's from the documentation for the Acrobat DC SDK07:13.53 
kens And how does that have anything to do with Ghostscript ?07:14.10 
  But anyway, you still seem to be using JPEG, not Flate07:14.31 
Badabing_ Well you see the ColorACSImageDict stuff in there? That's essentially controlling the threshold for when it decided to use FLATE vs JPEG07:14.34 
  decides*07:14.45 
kens Err, I don't think so, no07:14.52 
Badabing_ Then Adobe's documentation is wrong.07:15.06 
kens You can't assume that Ghostscript works the way Acrobat does07:15.11 
Badabing_ Ghostscript's documentation said mainly the same thing07:15.19 
kens That's because it was copied from teh Adobe documentation07:15.35 
Badabing_ sec...07:15.38 
  kens: Well I have a pdf that demonstrates that an image is being compressed with FLATE rather than JPEG.07:15.59 
  while having a very small file size07:16.04 
  so I know it's working07:16.12 
kens Hmm, well that surprises me.07:16.17 
  Of course, the JPEG compression code itself can switch to a different method.07:16.43 
Badabing_ https://www.ghostscript.com/doc/9.05/Ps2pdf.htm#Options07:17.13 
kens I suspect you have simply set it up so that the JPEG compressor moves to the lossless compression mode. You don't often see that in JPEG07:17.15 
Badabing_ AutofilterColorImages, see note 107:17.22 
kens Yeah AutoFilter is a different thing altogether07:17.52 
  That writes the images multiple times using different compression filters, and then looks to see which produced the smallest output, and uses that.07:18.26 
Badabing_ "If true, the compression filter for color images is chosen based on the properties of each image, in conjunction with the ColorImageAutoFilterStrategy setting. See Automatic compression for more information."07:18.31 
kens Besides which, that's the 9.05 documentation, the current version is 9.2107:18.58 
Badabing_ "You can use the ColorImageAutoFilterStrategy and GrayImageAutoFilterStrategy settings to choose between two automatic compression strategies. The value of these settings can be either JPEG (the default) or JPEG2000 (which applies only to PDF 1.5 and later files). If you choose JPEG:"07:19.03 
  "PEG compression (the DCTEncode filter) is used for 8-bit images that have smooth color changes (low-frequency images). The parameters specified in the ColorACSImageDict or GrayACSImageDict dictionary are used to provide further control. JPEG typically provides greater compression than Flate, but is lossy (can lose information)."07:19.14 
kens Yeah I still don't see anything there that says it switches between Flate and JPEG07:19.43 
  But frankly, if you're happy with what you have, its not important07:19.55 
Badabing_ "If true, the compression filter for color images is chosen based on the properties of each image"07:19.56 
  "You can use the ColorImageAutoFilterStrategy and GrayImageAutoFilterStrategy settings to choose between two automatic compression strategies." This leads to ColorACSImageDict...07:20.17 
  "The parameters specified in the ColorACSImageDict or GrayACSImageDict dictionary are used to provide further control. JPEG typically provides greater compression than Flate, but is lossy (can lose information)."07:20.23 
kens Yes, thaty's the AutoFilter strategy07:20.28 
Badabing_ ...yes, exactly.07:20.37 
  ColorACSImageDict is essentially controlling the filter.07:20.50 
kens Its controlling the JPEG filter, it won't have anythign relevant to the Flate filter07:21.13 
Badabing_ Images that wouldn't normally be filtered into FLATE are filtered into FLATE07:21.21 
kens AutoFilter is true, so all images are candidates for switching07:22.02 
Badabing_ right.07:22.10 
  I'm glad we agree?07:22.19 
kens So really you shouldn't need to play with the ACSImageDict and so on07:22.22 
  But as I said, if you're happy, I'm not going to worry about it07:22.35 
Badabing_ ahhh, I see what you're saying, actually.07:23.07 
kens Note that you haven't (or don't seem to) have set DownsampleColorImages to true, so the downsampling switches won't do anything07:23.14 
Badabing_ I think this is just making the jpegs a much higher quality07:23.18 
kens Essentially, yes07:23.29 
Badabing_ eh? I don't have any downsampling switches07:23.41 
  Default doesn't downsample07:23.44 
kens One day I'm hoping to implement the 'pass through' feature so that JPEGS don't get decompressed and recompressed07:23.51 
  'ColorImageDownsampleType /Bicubic07:24.11 
Badabing_ oh that was a leftover I forgot to remove07:24.29 
  the other command doesnt' have that07:24.33 
kens Though I see you removed that in the second command line07:24.34 
Badabing_ I wish I knew where to get the JPEG2000 library07:25.25 
kens There are plenty of places which will sell you one07:25.43 
  There are no free (compression) codecs because you need to pay the patent holders07:26.00 
Badabing_ Really? Where is it sold?07:26.25 
kens Well, there's Luratech that sell one07:26.36 
  THere were others, I'm sure a Google search will turn them up07:26.51 
  Kakadu still seesm to be in business07:27.17 
Badabing_ Luratech makes you request a trial07:27.34 
kens Is that a problem ?07:27.48 
  Like I said Kakadu is also in the business stil:07:28.21 
  http://kakadusoftware.com/07:28.21 
Badabing_ I just don't understand why they're not upfront about how much it would cost07:28.23 
kens Oh well, don't know about that.07:28.36 
Badabing_ kakadu isn't upfront about the price, either07:29.07 
kens I guess they probably want royalties07:29.09 
  So they can't give a price07:29.24 
  Its 'possible' openjpeg allows compression, I haven't looked07:30.06 
  Apparently it does07:30.24 
  Oh there's JasPer tooo fo course, but that's just horrible07:31.24 
Badabing_ Is Ghostscript compatible with Kakadu's implementation?07:31.50 
kens And here's another:07:31.54 
  http://dsplab.diei.unipg.it/software/c_quick_jpeg_2000_cqj2k07:31.54 
  Badabing_ : if you wanted to add JPEG2000 compression to Ghostscript you will have to do coding07:32.16 
Badabing_ But the make guide says if you have the source code you can just add it to their respective directories07:33.29 
  "To compile Ghostscript against the proprietary Luratech JBIG2 and JPEG 2000 implementations, simply ensure that the luratech/ldf_jb2 and luratech/lwf_jp2 containing the Luratech code exist in the top level gs source directory, and (re-)run configure (ensuring to make clean before re-running make). The configure script will detect the presence of the directories, and apply the appropriate settings in the Makefile."07:33.47 
kens Yes, that's because we licence Lueratech commercially for our paying custoemrs. So if you have the Luratech library then you can use our existing interface for it.07:34.25 
  That's the only one we have an interface for.07:34.41 
  It also doesn't permit the use of JPEG2000 compression07:34.51 
  So you would still need to add that to pdfwrite07:35.00 
Badabing_ but it can already read JPEG2000.07:35.13 
kens Yes, but that's not the same as writing it07:35.26 
Badabing_ No I mean, even without the luratech source code it can read JPEG2000 through openjpeg, so... it sounds like all this interface does is let you read JPEG2000 through Luratech's own code instead?07:36.14 
kens Yes07:36.22 
  Because its faster and more memory efficient07:36.30 
  and has fewer bugs07:36.36 
  And if it does have bugs we can get Luratech to fix them07:36.47 
Badabing_ Oh well.07:37.02 
deekej hello folks, the DEFAULT_VM_THRESHOLD value set the limit when the garbage collecting starts?14:32.35 
kens Not really, no14:33.39 
  the vmthreshold can be changed on the command line and by PostScript, that's just the default value.14:34.17 
  You can also trigger a garbage collection execution by various means14:34.33 
deekej okay, thanks :)14:36.42 
chrisl deekej: It would be more correct to say that DEFAULT_VM_THRESHOLD is the default value for a setting that /contributes/ to the decision of when to garbage collect14:36.55 
aidos Does anyonw have any experience with the svg output device? It seems to have been removed - anyone know why?21:53.30 
HenryStiles aidos: future svg output will likely happen in mupdf not ghostscript. I don't recall the history of the device, I remember it was unstable, so removed but then reinstated for a while, but anyway I recommend mupdf22:21.06 
aidos oh ok, interesting. I use mupdf to clean / decompress pdfs so I can read / hand edit them. I hadn't noticed that it could do SVG conversion. What's the state of that?22:26.15 
HenryStiles pretty sure it's as least as good as what gs had22:26.49 
  might want to ask on mupdf irc during european business hours22:27.33 
aidos great. thanks for the pointers. I'll have a play and dig around in the code to see where it seems to be at. Appreciate the help.22:28.35 
HenryStiles sure no problem22:29.23 
 Forward 1 day (to 2017/08/24)>>> 
ghostscript.com #mupdf
Search: