0

I am using reportLab to generate a pdf report. I downloaded a PNG from the internet and I created a PNG using R. In my viewer I can open both images. When I create a pdf I can add the image that I got from the internet to the PDF but I can't add the image I created using R (it just shows up as a black box). Why does canvas draw one but not the other? How do I trouble shoot this problem?

from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter, landscape
c = canvas.Canvas("Test.pdf", pagesize=landscape(letter))
c.drawImage("MYRGeneratedImage.png",0,0) #This wont work
c.drawImage("logo.png",350,50) #This works
c.showPage()
c.save()

I can't add images because I don't have 10 reputation points. However the png that is working can be found here: http://www.unixstickers.com/image/cache/data/stickers/python/xpython.sh-340x340.png.pagespeed.ic.fbORd6iZuV.png

and I can't get on any image hosting websites because I am at work so here is R code to create an image:

    data <- c(1,2,3,4,5,4,3,2,1)
    png(file="MYRGeneratedImage.png", bg="transparent")
    hist(data,main="Test Diagram")
    dev.off()
SKiD
  • 1,094
  • 7
  • 4
  • Could you provide the two images? This looks like a transperency issue. maybe this helps: [link](http://stackoverflow.com/questions/1308710/transparency-in-pngs-with-reportlab-2-3) – Fookatchu Feb 25 '14 at 09:25
  • @Fookatchu I edited the question to include the PNG info, good call! – SKiD Feb 25 '14 at 15:58
  • Have you tried the mask='auto' part from the link i posted? I don't have R, so i can't really help you there. if you want you can send me the image to ayinlz@orgizm.net – Fookatchu Feb 26 '14 at 11:44

0 Answers0