[
https://issues.apache.org/jira/browse/IMAGING-126?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13911655#comment-13911655
]
Gary Lucas edited comment on IMAGING-126 at 2/25/14 3:33 PM:
-------------------------------------------------------------
Just found an Adobe Tech Note from 2002 that recommended using 32K rather than
8K for strip size (Adobe took over the management of the TIFF format in the
90's). That setting results in a storage size of about 543 K on disk...
Still bigger than the target 400 K, but better than 1.04 MB. I've still got
the problem with the black strip on the bottom.
If I set the strip memory size to target 64K, I get an output file size of 400
K, which is about the same as your target size. I can increase the strip size
further and get further reductions, though at some point, the output violates
some format issue because Microsoft Windows Photo Viewer complains about an
improper TIFF file format.
The other interesting thing I found is that the original author wrote his own
LZW compression code. At first I wondered why he didn't just use the standard
Java API, but after I posted my original comment here (this one is a revision),
I realized it's because the standard doesn't provide an LZW compressor, just a
GZIP compressor. In any case, the write times for your test image are running
about 3.3 seconds on my computer. I'm willing to bet that there's room for
improvement in the compressor in terms of performance. In general, the original
author was attentive to correctness-of-implementation issues, but less
interested in performance. Last year, we were able to make substantial speed
improvements with the reading of TIFF images. We may be able to find ways to
improve the speed of the writing. .
was (Author: gwlucas):
Just found an Adobe Tech Note from 2002 that recommended using 32K rather than
8K for strip size (Adobe took over the management of the TIFF format in the
90's). That setting results in a storage size of about 543 K on disk...
Still bigger than the target 400 K, but better than 1.04 MB. I've still got
the problem with the black strip on the bottom.
If I set the strip memory size to target 64K, I get an output file size of 400
K, which is about the same as your target size. I can increase the strip size
further and get further reductions, though at some point, the output violates
some format issue because Microsoft Windows Photo Viewer complains about an
improper TIFF file format.
The other interesting thing I found is that the original author wrote his own
LZW compression code. Perhaps he wrote the code before LZW compression was
part of the standard Java API. In any case, the write times for your test
image are running about 3.3 seconds on my computer. I'm willing to be that if
the code were changes to use the standard Java API version of the compressor,
it would speed that up substantially. So there could be opportunity to make
the package faster for your application in the future.
> TIFF and PNG images should not be bigger than the ones created by java ImageIO
> ------------------------------------------------------------------------------
>
> Key: IMAGING-126
> URL: https://issues.apache.org/jira/browse/IMAGING-126
> Project: Commons Imaging
> Issue Type: Improvement
> Components: Format: PNG, Format: TIFF
> Affects Versions: 1.0
> Environment: W7
> Reporter: Tilman Hausherr
> Priority: Minor
> Attachments: pdfbox-1870-devicen3-01.png,
> pdfbox-1870-devicen3-01.tif, pdfbox-1870-devicen3.pdf-1.png,
> pdfbox-1870-devicen3.pdf-1.tif
>
>
> I tried to use Apache Imaging for the PDFBOX project (PDFBOX-1734) because of
> problems with setting the tiff resolution in java imageio.
> While the code is pretty nice, I found that the generated images are
> sometimes much bigger in size than the ones generated by java imageio.
> Example:
> pdfbox-1870-devicen3-01.png 50 KB (imageio)
> pdfbox-1870-devicen3.pdf-1.png 70 KB (imaging)
> pdfbox-1870-devicen3-01.tif 401 KB (imageio)
> pdfbox-1870-devicen3.pdf-1.tif 1063 KB (imaging)
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)