OK, found a solution.
Basically, blender is missing an EXIF reader. Luckily, python has the modules. We just need to install it.
Below is a basic method to install a module
But did not work for me. Perhaps, its because of the office firewall or network....
So I installed the module using the wheel file, .whl, with the function below with blender (Not a powershell)
# path to python.exe
python_exe = os.path.join(sys.prefix, 'bin', 'python.exe')
# install required packages
subprocess.call([python_exe, "-m", "pip", "install", "C:/LOCATION AND FILENAME.whl"])
Don't need to install pip because since 2.8 its already installed.
I am using the ExifRead module. Arbitrary selection. The code below gets me the dpi I want.
# Open image file for reading (binary mode)
f = open('C:/Users/csemeon/Desktop/Fabric/RED 1200dpi.jpg', 'rb')
# Return Exif tags
tags = exifread.process_file(f)
for tag in tags.keys():
if tag in ('Image XResolution'):
#print ('Key: %s, value %s' % (tag, tags[tag]))
dpitest = str(tags['Image XResolution'])
dpi = float(dpitest)
Had to use a two steps to convert the value to float (or int). Because the Dpi is a tag and doesn't convert directly to float.
Hope it helps someone.