[reportlab-users] Patch: PIL images with ReportLab
Andy Robinson
andy at reportlab.com
Wed Apr 27 17:22:13 EDT 2005
> I've been fighting with using PIL images and ReportLab on and off for a
> few days now, and finally took at look at the utils.py code to see how
> ImageReader works. Basically it looks like it accepts a file name or
> file like object and then loads it as a PIL image if the platform is NOT
> java, and uses some java image type if it is.
> It seemed somewhat circuitous to take a PIL image, put it in a StringIO
> wrapper, create an ImageReader object with it, to have the
> ImageReader.__init__ convert it back to a PIL image. Why not just
> make the __init__ accept PIL images in the first place?
Thanks Sam. You're right, this does sound silly.
I think this was all done by a Java person we had here a
while ago who (quite impressively) go 100% byte-identical
output from the test suite, and we haven't thought hard about
it since. He didn't know much about PIL.
We need to check it does not break under Jython 2.1,
but obviously it will not be passed PIL images in
that case. So I have no problem in principle with
making PIL Image objects legal and simplifying it.
Robin, any opinions? (answer expected tomorrow UK time)
- Andy Robinson
> So, I made a few small modifications. They work perfectly in my small
> test script. If they look good, could it go into the source?
> Also, it looks like the canvas.drawImage() could very easily be
> modified to take PILs as well.
>
> Thanks,
>
> Sam Hunter
More information about the reportlab-users
mailing list