This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now.
1 / 6
Jun 2018

With appium you can get widht and height of the screen like this:

driver.manage().window().getSize().getHeight()
driver.manage().window().getSize().getWidth()

…but if you want to know sizes of the image you can do this with Java:

try {
File f = new File(ScreenshotPath);
BufferedImage image = ImageIO.read(f);
int height = image.getHeight();
int width = image.getWidth();
}catch(…)…

Thank you @MrZigaS. Do you know how to get the scale ratio for screen shot? I have a webview with fixed width and height. I need to scale the image fit to webview size. how to do that in java ?