0

I am doing a script to generate a report on PDF after some image analysis, the problem is that reading the examples of reportlab they load an image by filename and then generate it on the report, but I have the image as a np.array and don't want to save it because there will be a lot of images, and when I tried to do this reportlab command

#asd is the image variable
asd=plt.imread(imagen_fl)
#then do some image processing.... 
canvas.drawImage(asd, 1*cm, 3*cm, 10*cm, 10*cm )

I get the next error:

AttributeError: 'numpy.ndarray' object has no attribute 'rfind'

Any solution or recomendation?

Ivan
  • 1,069
  • 1
  • 9
  • 14
  • Ivan, your question might be a duplicate of https://stackoverflow.com/questions/18897511/how-to-drawimage-a-matplotlib-figure-in-a-reportlab-canvas – Warren Weckesser May 03 '18 at 22:59
  • Also, take another look at the [documentation for `canvas.drawImage`](http://nullege.com/codes/search/reportlab.pdfgen.canvas.Canvas.drawImage), and note that the function does not accept numpy arrays as the first argument. – Warren Weckesser May 03 '18 at 23:07

0 Answers0