Free Support Forum - aspose.com

How to get resolution of images using aspose.imaging java

Hi Team,
Is this possible to get resolution of jpeg image using Aspose.imaging in java.

sample1:sample2.zip (549.9 KB)

Thanks & regards,
Priyanga G

@priyanga,

I suggest you to please try using following sample code on your end.

public static void GetJpegDimension()
{

    String path = "C:\\Imaging Data\\";
   Image image = com.aspose.imaging.Image.load(path + "sample2.jpeg");
   System.out.println("Horizontal: "+image.getWidth());
   System.out.println("Horizontal: "+image.getHeight());
   
}

Hi @mudassir.fayyaz ,

Thanks for your feedback.

please kindly help me to get the resolution of image instead of height and width.

Thanks & regards,
Priyanga G

@priyanga,

I suggest you to please try using following code on your end.

public static void GetJpegDimension()
{
    String path = "C:\\Imaging Data\\";
    JpegImage image = (JpegImage)Image.load(path + "sample2.jpeg");
    System.out.println("Horizontal Resolution: "+image.getHorizontalResolution());
    System.out.println("Vertical Resolution: "+image.getVerticalResolution());
}