[reportlab-users] Writing smaller image-only PDFs

Robin Becker robin at reportlab.com
Fri Feb 10 03:44:59 EST 2006


Nicholas Watmough wrote:
> I tried creating the PDF using PNGs. When saved, the PNGs were 
> approximately 100KB or less each. But when put into a PDF,. the PDF was 
> approximately 2MB. GIFs were about 800KB each, but the PDF was still 2MB.
> 
> Not sure why approx. 1.1MB of PNGs create a 2MB PDF. Seems something is 
> going on.
> 
> Not sure what else I can try.
> 
> Nathan wrote:

All images other than jpeg are treated equivalently; they are first 
converted into a number of planes and then the same compression and 
asciification is carried out on them to create pdf objects. That's 
probably why the png and gif versions end up pretty much the same size.

I think the reason for the size doubling is probably the use of ascii85 
encoding for the compressed images.

It should be possible to eliminate the ascii85, but last time I tried I 
got it wrong so will need to think a bit more about it.
-- 
Robin Becker



More information about the reportlab-users mailing list