Getting wrong image when I try to capture element from the iOS device view

I have a custom method to capture element from Android and iOS screen, it will return the specific element from the view as image. The method is working as expected in Android and in case of iOS it fails. In iOS am getting wrong image as output. Following are the code I used for the actions:

WebElement ele = driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAButton[1]"));

BufferedImage eleScreenshot;
File screenshot = null
screenshot = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
BufferedImage fullImg =;
Point point = ele.getLocation();
int eleWidth = ele.getSize().getWidth();
int eleHeight = ele.getSize().getHeight();
eleScreenshot = fullImg.getSubimage(point.x, point.y, eleWidth, eleHeight);

ImageIO.write(eleScreenshot, “png”, new File("/Users/abc/Desktop/efg/", “saaa”));

Anyone have the idea about the difference?