Real image size in pixels

How can I get real size (width and height) in pixels of an image after displaying it on a form?
If I set initial width/height in percents, I cannot get them in pixels by getWidth and getHeight methods. If they remained empty in designtime, getWidth and getHeight methods give me -1.

Hi,

Unfortunately, you cannot manipulate images on web page due to Vaadin limitations. You can only read images from file system using Java Image IO API and obtain real width/height from it. https://docs.oracle.com/javase/7/docs/api/javax/imageio/ImageIO.html