how to get the a value of the resolution of an image in blender compositor?
You can use a driver to easily get the render resolution from the scene, for a user selected image it gets tricky as you will need to know the name of the image or the image node to reference it's resolution.

I think you could achieve that with a custom python node but at this stage they don't integrate well, they don't update when a connected node changes so need manual updating which can lead to errors.