Write a python function to find the resolution on the user provided image


Topic: Write a python function to find the resolution on the user provided image

Solution

def jpeg_res(filename):
   with open(filename,'rb') as img_file:
       img_file.seek(163)
       a = img_file.read(2)
       height = (a[0] << 8) + a[1]
       a = img_file.read(2)
       width = (a[0] << 8) + a[1]
   print(f"The resolution of the image is {width}x{height}")



List all Python Programs