Possible to get the ratio value from an image?

Hello,

I’m trying to see what I can do with nodes in the shader editor and I was wondering:
Is is possible to load an image texture and then get the aspect ratio of this image as a value?

My goal is to get my image to keep their initial ratio, without any stretching and I saw this topic https://blender.stackexchange.com/questions/116129/how-to-keep-procedural-texture-proportion-automatically

The trick of using a Math node with the 1080/1920 ratio seem to work for landscape image, but if I want to import a vertical image it won’t work correctly.

Is there a way to always keep the ratio of an image untouched? Wherever the image is vertical or horizontal?

Thank you!

Hmm in this example the compositor is used (which stretches to the imagecoordinates) and you wanna use the shader editor… (which uses texture coordinates) ? Usually someone uses UV’s which should be with correct ratio or use UV projection (automatic ratio) or use object coordinates which will have (if scale has beeen applied) correct ratio. So you may rethink what you doing ??