[reportlab-users] Image + StringIO + Platypus(?) = big PDF
Felipe Lessa
felipe.lessa at gmail.com
Thu Nov 15 12:12:17 EST 2007
I modified your script and added the following lines:
story = [ Image(file(imgFile, 'rb'), width = size[0], height = size[1]) ]
doc = SimpleDocTemplate('test-file.pdf')
doc.build(story)
And these are the results:
$ identify img1.jpg
img1.jpg JPEG 2048x1536 DirectClass 653kb
$ ls -lah *.pdf *.jpg
-rwx------ 1 felipe felipe 653K 2007-11-15 15:06 img1.jpg
-rw-r--r-- 1 felipe felipe 817K 2007-11-15 15:08 test-direct.pdf
-rw-r--r-- 1 felipe felipe 8,5M 2007-11-15 15:09 test-file.pdf
-rw-r--r-- 1 felipe felipe 8,5M 2007-11-15 15:09 test-stringio.pdf
So it seems that it puts the uncompressed image everytime you give
Image a file-style object. Also, test-file and test-stringio both
needed a huge time to run.
See ya,
--
Felipe.
More information about the reportlab-users
mailing list