[reportlab-users] Image Quality in Drawing

chadsjunkmail at mac.com chadsjunkmail at mac.com
Fri May 12 10:15:03 EDT 2006


I am creating a Drawing and adding an image (jpeg) to it along with  
some text.  The problem I am having is that when I save the Drawing  
back to an image (jpeg), the quality is greatly reduced.  Is there  
any way to specify a quality level when I call asString()?  If not,  
is there another method I can use to save my drawing as a jpeg that  
won't reduce the quality?  A snipet of my code is shown below and I  
have included links to copies of the image before processing and one  
after so you can see what I am talking about.  You can see that the  
quality in the second image is not quite as good and its size has  
been reduced from 148kb to 28kb.

> c = Drawing(img_width, img_height)
> c.add(Image(0,0,img_width, img_height, image_file.name))
> c.add(wrappedString(text_x,text_y,text_w,text_h,text))
> format = 'jpg'
> return c.asString(format)

Thanks in advance for your help.  I have been a subscriber to the  
list for quite some time, and although this is the first time I have  
asked a question, I have learned a great deal from the experts here.

-Chad

unprocessed image: http://www.ewavegroup.com/webshare/personal/ 
unprocessed.jpg
processed image: http://www.ewavegroup.com/webshare/personal/ 
processed.jpg


More information about the reportlab-users mailing list