[reportlab-users] Optimizing greyscale and bilevel images

Jesus Cea jcea at jcea.es
Wed Dec 28 18:00:09 EST 2011


-----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.

- --
Jesus Cea Avion _/_/ _/_/_/ _/_/_/
jcea at jcea.es - http://www.jcea.es/ _/_/ _/_/ _/_/ _/_/ _/_/
jabber / xmpp:jcea at jabber.org _/_/ _/_/ _/_/_/_/_/
. _/_/ _/_/ _/_/ _/_/ _/_/
"Things are not so easy" _/_/ _/_/ _/_/ _/_/ _/_/ _/_/
"My name is Dump, Core Dump" _/_/_/ _/_/_/ _/_/ _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQCVAwUBTvufeZlgi5GaxT1NAQLMlAP8DWac4qBbD5lbFTuTMqVz8uokPqFuAYgw
xBM8lFeqmNyajp7xnga/UWE6rb6bVnkE4FcPMLO7rQf8yxcVQRAWHqfGDikcBsst
PPsxYM/0us+E1WzDxa3LR25xH6G2L7Xb4McE9hltcrr+dYyXUyFAd5B8BlZOQ13v
378iuVl2zC4=
=mvSb
-----END PGP SIGNATURE-----


More information about the reportlab-users mailing list