[reportlab-users] Optimizing greyscale and bilevel images
Glenn Linderman
v+python at g.nevcal.com
Sat Dec 31 14:18:35 EST 2011
On 12/28/2011 3:00 PM, Jesus Cea wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Checking pdfgen/pdfimages.py, grayscale JPEG files are detected and
> used, but any other imagefile is converted to RGB.
>
> I have bilevel PNG files that when printed as PDF using reportlab are
> expanded THREE times.
>
> Seems quite trivial to detect "1", "L" and indexed files in PIL
> images, and generate optimized representation. Supporting "1" or "L"
> natively seems to be 5 lines of code or less.
>
> Are you interested in a patch?.
>
> Grayscale seems trivial. Bilevel seems easy. Indexed... I am not
> familiar with PDF format, and reading the spec it is not very clear to
> me how to do it, beside the ability of PDF supporting this.
>
> PS: I am using ReportLab 2.4.
In my work with bilevel images, I have found that TIFF with Group 4
compression seems to produce the smallest files with lossless
compression, or DJVU even smaller, but I think just slightly lossy. I
think the bilevel compression used by PDF is also Group 4?
Am I correct that PNG doesn't support Group 4 compression, or am I
missing an option that would allow bilevel PNG files to be as small as
TIFF/Group 4 ?
I'd support the idea of your creating a patch :) I'd even be willing to
help test a Windows build of it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20111231/e400559b/attachment.html>
More information about the reportlab-users
mailing list