1

I installed pillow in python and used the module in the definition.

I tried doing this:

pil_image = Image.open(url)
cvs=str('L,W:') + str(pil_image.size)+str('H,V:') + str(pil_image.info['dpi'])

Some images don't have information in the properties, so DPI is not working . I need to populate PPI as well.

Can you please suggest a solution?

user16301
  • 11
  • 5
  • 1
    If DPI doesn't exist, there's no way for you to get DPI or PPI. DPI is considered like extra information, which has to be explicitly declared in the file itself. PIL only sees a byte-array of pixels. – NinjaKitty Jul 20 '17 at 16:49
  • In adobe photo viewer , we are able to see the DPI and PPI for the image ...even its not in image properties. – user16301 Jul 20 '17 at 20:53
  • Can I ask what PPI/DPI is this? If PPI is 96 or 72, that's simply the default PPI for any image that contains no value for PPI. – NinjaKitty Jul 20 '17 at 21:32
  • Any leads here? – Shivam Sahil May 03 '21 at 09:37

0 Answers0