0

Could you please advise how can we convert the <PIL.Image.Image image mode=L size=675x1200 at 0x16193333D48> to Real image through Python. Because when I storing outputimg in FTP its storing like "<PIL.Image.Image image mode=L size=675x1200 at 0x16193333D48>" not actually the image.

When I do print output --> C:/Projects/Python/input/2.jpg outputimg --> <PIL.Image.Image image mode=L size=675x1200 at 0x16193333D48>

output = 'C:/Projects/Python/input/2.jpg'
outputimg = remove(Image.open(output))
print(output)
print(outputimg)

So appriciate someone help to convert this PIL value to real image.

  • What do you mean by "real image" ? Do you mean an openCV image ? – LCMa Nov 03 '22 at 16:03
  • 1
    I think this question is the same as yours, isn't it (see link)? Here the image is loaded into a numpy array and you can look at the values. https://stackoverflow.com/questions/384759/how-do-i-convert-a-pil-image-into-a-numpy-array – TechnicTom Nov 03 '22 at 16:04
  • Have you tried [Image.save()](https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.save)? It saves an image as a file. – Nick ODell Nov 03 '22 at 16:07
  • `Because when I storing outputimg in FTP its storing like` What code are you using to store the output image in FTP? If all you want to do is copy an image to FTP without changing it, I would suggest you avoid using PIL at all. – Nick ODell Nov 03 '22 at 16:09
  • Hi Nick, I am actually removing the background of the image by doing remove(Image.open(output)) and storing that image directly to FTP, I don't want to save it in local. Image.save() save the file in local successfully. But my interest in saving the file directly in FTP. But FTP its storing like "" – Manoj Poosalingam Nov 03 '22 at 16:17
  • And can see full code where I am trying to upload converted image to FTP here - https://stackoverflow.com/questions/74292103/need-ftp-the-file-without-storing-interpreter-file-save-in-local-through-python/74295390?noredirect=1#comment131168323_74295390 – Manoj Poosalingam Nov 03 '22 at 16:31

0 Answers0