graphics as png files (total files size about 2 Mb) are expanded to some bitmap? representation in pdf leading to a massive increase in file size (from 0.6 Mb using version 2 to 10 Mb using version 0.92). Is there some way of specifying that compressed graphics should be used in the pdf. (The graphics are actually math equations - fairly complicated with integrals etc, and some simple graphs of functions like normal distribution. About 30 of each, so quite a lot of work to change representation ;-) Is there some other workaround? vector format?)
PNG images are currently decompressed, normalized to RGBA (32bit) and then recompressed for PDF. Of course, that's suboptimal. Yes, it's theoretically possible to embed the compressed PNG data directly in the PDF. This is something that is on my task list for the next three months as part of a general redesign of the image adapter package which is also responsible for the implicit conversion to RGBA of the image. Work-arounds for you: Yes, please try a vector format, preferably SVG because we can handle this natively. Your equations will look much nicer.
Thanks for helpful comment and promises ;-) But meanwhile: Do you any recommendations on MathML to SVG conversion. A quick Google turns up some tools but some seem not to work well yet. We also have a problem with simple x y graphs to show simple functions as coloured curves, for example normal distribution 'bell' curve. Do you have suggestions for doing these (from tables of data as decimal digits). Thanks Paul
We use JEuclid. See the FO extension in examples/mathml
resetting P2 open bugs to P3 pending further review
change status from ASSIGNED to NEW for consistency
Created attachment 28771 [details] output PDF of test case after fix
sorry, above attachment, 28771, is for bug 40699. stupid bugzilla...
Created attachment 28929 [details] patch this patch includes new image handlers for PNG for PDF and PS output. these image handlers can handle the raw IDAT chunk and lead to smaller files. to use these handlers the ImageLoaderRawPNG needs to be enabled in the fop.xconf file.
Created attachment 28930 [details] test examples the attachment includes a test.fo file, some test images, a fop.xconf, and PDF and PS output of the test file. note that the image loader in the fop.xconf needs to be enabled/disabled.
Created attachment 28932 [details] another example this example uses a larger image to better show the differences in file size of the resulting PDF.
patch applied at http://svn.apache.org/viewvc?rev=1350455&view=rev thanks luis and matthias! luis, please provide an additional patch (against this rev) that fixes the 13 findbugs warnings you introduced (I fixed the 2 checkstyle warnings introduced); also update the relevant documentation to describe the configuration/use of these features in the mean time, I will transition this bug to NEEDINFO
Created attachment 28944 [details] patch for findbugs fixes/ignores findbugs
Wiki updated: http://wiki.apache.org/xmlgraphics-fop/HowTo/ImageLoaderRawPNG
findbugs fix patch applied at http://svn.apache.org/viewvc?rev=1350790&view=rev thanks luis! please review and close if satisfied
(In reply to comment #13) > Wiki updated: http://wiki.apache.org/xmlgraphics-fop/HowTo/ImageLoaderRawPNG you may also want to update [1] and [2] [1] http://xmlgraphics.apache.org/fop/trunk/graphics.html#png [2] http://xmlgraphics.apache.org/fop/trunk/configuration.html#image-loading for example, adding info to [1] about the new codecs, and adding info to [2] about negative penalties
Created attachment 28950 [details] patch for documentation I was not aware the web pages content was part of the source too... The patch updates the documentation.
(In reply to comment #16) > Created attachment 28950 [details] > patch for documentation > > I was not aware the web pages content was part of the source too... The > patch updates the documentation. Applied final docs patch at http://svn.apache.org/viewvc?rev=1351540&view=rev. Thanks luis! Please close this bug when you finish review.
Created attachment 28988 [details] patch to disallow multiple image filters Adobe Reader fails to display the submitted examples when the raw png image loader is used, even though they seem valid according to the spec, and are correctly displayed by evince, ghostscript and Preview (Mac OS X PDF viewer). The Adobe Reader issue only happens if the filter flate is turned on and seems to be due to the fact that Adobe Reader may not like more than one filter applied to an image. Multiple filters applied to a stream are valid, but are also used by PDF malware exploits (like zip bombs). I suspect this is the reason why Adobe Reader does not like them. The patch fixes this problem by only using one image filter even when the default flate filter is turned on.
Created attachment 28989 [details] update to previous test examples
Created attachment 28990 [details] update to previous example
(In reply to comment #18) > Created attachment 28988 [details] > patch to disallow multiple image filters > > Adobe Reader fails to display the submitted examples when the raw png image > loader is used, even though they seem valid according to the spec, and are > correctly displayed by evince, ghostscript and Preview (Mac OS X PDF > viewer). The Adobe Reader issue only happens if the filter flate is turned > on and seems to be due to the fact that Adobe Reader may not like more than > one filter applied to an image. Multiple filters applied to a stream are > valid, but are also used by PDF malware exploits (like zip bombs). I suspect > this is the reason why Adobe Reader does not like them. > > The patch fixes this problem by only using one image filter even when the > default flate filter is turned on. patch applied at http://svn.apache.org/viewvc?rev=1353303&view=rev thanks luis!
(In reply to comment #19) > Created attachment 28989 [details] > update to previous test examples not sure what to do with these... do you wish to commit to trunk somewhere? if so, you need to organize into standard test cases, etc
no, the idea was never to make these part of the source. they are just provided to show what type of png images are currently supported by the new png image loader, and that the resulting output files are smaller.
(In reply to comment #23) > no, the idea was never to make these part of the source. they are just > provided to show what type of png images are currently supported by the new > png image loader, and that the resulting output files are smaller. ok, if you don't think any additional test cases are useful for this bug, then please close this when you're ready
Created attachment 29132 [details] support for sRGB and iCCP chunks this new patch improves the previous one and adds support to color spaces to the PDFImageHandlerRawPNG.
Created attachment 29133 [details] example with ICC profiles
Created attachment 29134 [details] example images with ICC profiles
Created attachment 29135 [details] example with sRGB profile (sRGB chunk)
Created attachment 29136 [details] example images with sRGB chunk
Although file size increase is now solved, I am reopening this issue as a reminder to apply patches starting with attachment 29132 [details]. Those new patches perform better, and they also solve issue 51149.
applied patch 29132 with changes: http://svn.apache.org/viewvc?view=revision&revision=1400536