You need a Java-Action to achieve this, e.g. using Java ImageIO to create a BufferedImage (details here: https://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferedImage.html) from which you can get width and height. Parameter of this Java Action would be your image, and output would be a non persistent entity that has an attribute for each image property that you want to validate.
Mendix does not store this information which you can check by reviewing the entities Image and FileDocument in module System.