Image size not changing after varying resolution (dpi)

When I tried to change the resolution (dpi ) of an image, the file size is not changing and remains the same. I tried changing the resolution as 50 dpi, 300 dpi, 1000 dpi. In all the 3 cases the file size is same. Is this an issue or a normal behaviour? I have attached the samples for reference.
Karthi (1.0 MB)


Can you please share the sample code that you have used on your end. We will be able to proceed further with investigation on our end on provision of requested inforamtion.

Hi @mudassir.fayyaz ,
This is the sample code which I used for resizing the image.

    Image image =  Image.load("sample.jpg");
    JpegOptions jpgOptions = new JpegOptions();
    jpgOptions.setResolutionSettings(new ResolutionSetting(50,50)); imageStream = new"resized.jpg");, jpgOptions);


I have added a ticket with ID IMAGINGJAVA-1973 in our issue tracking system to further investigate and resolve the issue on our end as it needs investigation. We will share the good news with you as soon as the issue will be fixed.

Hi @mudassir.fayyaz,
Does any of the older version of aspose.imaging jar changes the file size when resolution is changed? If so please let me know so that we can use it for time being.


I am sorry, I may not be able to share this. However, I have added ticket based on latest version and we will share the good news with you as soon as the issue will be addressed.

Hi @mudassir.fayyaz,
Any update regarding this issue?
We have a requirement for the dpi level conversions.


I regret to share that at present the issue is unresolved. We request for your patience and will share the good news with you as soon as the issue will be fixed.

Gentle Remainder: Any update regarding this issue…?


We have internally verified the issue and it’s concluded not to be a bug rather than a clarification. Actually, A size of file does not depend on DPI but it mostly depends on image resolution in Pixels and JPEG Quality. Therefore, changing DPI won’t affect the file size. I hope the shared elaboration will be helpful.


I have shared the feedback with our team and will get back to you as soon as the issue will be addressed.

In order to drop in quality, the dpi is not a physical characteristic of the image, any image is always stored exclusively in pixels without taking into account dpi, and the file size depends on the size of the image in pixels. As for the task itself, you can see that no graphics editor changes the resolution in pixels when the dpi changes. This is a general approach and is not an issue of Aspose.Imaging.

If you want to preserve the quality when changing the dpi, you can first call resize the original image, then change the dpi.
For example this way:

RasterImage image = (RasterImage)Image.load("sample.jpg");
    final double newXdpi = 50;
    final double newYdpi = 50;

    double xCoef = newXdpi / image.getHorizontalResolution();
    double yCoef = newYdpi / image.getVerticalResolution();
    image.resize((int) (image.getWidth() * xCoef), (int) (image.getHeight() * yCoef), ResizeType.HighQualityResample);
    JpegOptions jpgOptions = new JpegOptions();
    jpgOptions.setResolutionSettings(new ResolutionSetting(newXdpi, newYdpi));"resized.jpg", jpgOptions);