[reportlab-users] Failing to import a JPEG

Dinu Gherman gherman at darwin.in-berlin.de
Wed May 18 13:53:04 EDT 2016


Andy Robinson <andy at reportlab.com>:
> 
> Try leaving PIL completely out of it and just passing in the
> filename....JPEGs can be inlined into the PDF directly...
> 
> 
> def drawImage(self, image, x, y, width=None, height=None, mask=None,
>            preserveAspectRatio=False, anchor='c'):
>        """Draws the image (ImageReader object or filename) as specified.
> 
>        "image" may be an image filename or an ImageReader object.

Gosh, that works! Thank you!! That will do for now...

BTW, this is a nice, compact way of creating clean, throw-away Python environments
for testing (here on OS X):

wget https://repo.continuum.io/miniconda/Miniconda-latest-MacOSX-x86_64.sh
bash Miniconda-latest-MacOSX-x86_64.sh -b -f -p ./miniconda2
./miniconda2/bin/pip install -U pip
./miniconda2/bin/pip install reportlab
./miniconda2/bin/pip freeze
./miniconda2/bin/python my_test.py

Cheers,

Dinu




More information about the reportlab-users mailing list