Hi,
I want to get the width and height of the captured native screenshot ?
created
Jun '18
last reply
Jun '18
- 5
replies
- 278
views
- 3
users
- 1
link
Hi,
I want to get the width and height of the captured native screenshot ?
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 ?