Found a nice solution in another Stackoverflow post (using only standard libraries + dealing with jpg as well): JohnTESlade answer
And another solution (the quick way) for those who can afford running 'file' command within python, run:
import os
info = os.popen("file foo.jpg").read()
print info
Output:
foo.jpg: JPEG image data...density 28x28, segment length 16, baseline, precision 8, 352x198, frames 3
All you gotta do now is to format the output to capture the dimensions. 352x198 in my case.