You can list all referenced textures in the scene and then use : cmds.ls("REF_NAME:*", type="file")
To query all references : cmds.file(q=1,r=1)
---EDIT---
I had time to write a full code example :
import maya.cmds as cmds
import glob
files = cmds.ls(type=["file", "imagePlane"])
result = []
for i in files:
if cmds.objectType(i) == "file":
#animated ?
testAnimated = cmds.getAttr("{0}.useFrameExtension".format(i))
if testAnimated:
# Find the path
fullpath= cmds.getAttr("{0}.fileTextureName".format(i))
# Replace /path/img.padding.ext by /path/img.*.ext
image = fullpath.split("/")[-1]
imagePattern = image.split(".")
imagePattern[1] = "*"
imagePattern = ".".join(imagePattern)
# You could have done a REGEX with re module with a pattern name.padding.ext
# We join the path with \\ in order to be Linux/Windows/Apple format
folderPath = "\\".join(fullpath.split("/")[:-1] + [imagePattern])
# Find all image on disk
result+=(glob.glob(folderPath))
else:
result.append(cmds.getAttr("{0}.fileTextureName".format(i)))
elif cmds.objectType(i) == "imagePlane":
#animated ?
testAnimated = cmds.getAttr("{0}.useFrameExtension".format(i))
if testAnimated:
# Find the path
fullpath= cmds.getAttr("{0}.imageName".format(i))
# Replace /path/img.padding.ext by /path/img.*.ext
image = fullpath.split("/")[-1]
imagePattern = image.split(".")
imagePattern[1] = "*"
imagePattern = ".".join(imagePattern)
# You could have done a REGEX with re module with a pattern name.padding.ext
# We join the path with \\ in order to be Linux/Windows/Apple format
folderPath = "\\".join(fullpath.split("/")[:-1] + [imagePattern])
# Find all image on disk
result+=(glob.glob(folderPath))
else:
result.append(cmds.getAttr("{0}.imageName".format(i)))
#clear multiple instance
result = list(set(result))