How to get image height and width using java?
Here is something very simple and handy. BufferedImage bimg = ImageIO.read(new File(filename)); int width = bimg.getWidth(); int height = bimg.getHeight();
Here is something very simple and handy. BufferedImage bimg = ImageIO.read(new File(filename)); int width = bimg.getWidth(); int height = bimg.getHeight();
I was just playing around with this same subject, which is the fastest way to access the pixels. I currently know of two ways for doing this: Using BufferedImage’s getRGB() method as described in @tskuzzy’s answer. By accessing the pixels array directly using: byte[] pixels = ((DataBufferByte) bufferedImage.getRaster().getDataBuffer()).getData(); If you are working with large images … Read more