Convert Picture into Byte, Get Image Width and Height using Java

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File (“C:\test50.png”); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + “x” + height); } } Notify me of follow-up comments by email. Notify me of new posts by email.

Δ

How to Convert Picture into Byte  Get Image Width and Height using Java - 89How to Convert Picture into Byte  Get Image Width and Height using Java - 74How to Convert Picture into Byte  Get Image Width and Height using Java - 22How to Convert Picture into Byte  Get Image Width and Height using Java - 9