Get image width and height

We expose images over a REST api. To expose the image is fine, but now the customer also need the width and height of the image. Is there a way to do this or do we need to build our own JA?
2 answers

Hello Kim,

Could you try JA following:

        // BEGIN USER CODE
        try {
            if (img == null)
                throw new Exception("Image was be null.");
            InputStream is = Core.getFileDocumentContent(getContext(), __img);
            BufferedImage bimg =;
            int width          = bimg.getWidth();
            int height         = bimg.getHeight();
            ImageDimension imgDimension = new ImageDimension(getContext());
            return imgDimension.getMendixObject();
        } catch (Exception e) {
            throw new com.mendix.systemwideinterfaces.MendixRuntimeException(e);
        // END USER CODE

Note: The "__img" is IMendixObject.