How to get the Width and Height of Images or Elements using selenium webdriver

package SeleniumLearn.COM;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.Test;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;
public class ImageWidhtandHeight {
        public WebDriver driver;
                public void WidthandHight() throws Exception {
                driver.findElement(By.linkText("About Us")).click();

                Dimension d=driver.findElement(By.className("image-style-none")).getSize();
                System.out.println("Width : "+  d.width); //Print the Width of the Image
                System.out.println("Height : "+ d.height); //Print the Height of the Image
           public void beforeTest() {
           driver= new FirefoxDriver();
           public void afterTest() {