Practical 8: Write a program to find resolution of JPEG image.
Code :
Code :
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("The resolution of the image is",width,"x",height)
jpeg_res("image.jpg");
Output:
Code Thanks :
We thank Programiz for this code
https://www.programiz.com/python-programming/examples/resolution-image
Next :
Practical 9 A* Search