Free Support Forum - aspose.com

AutoRotate jpeg image

Hi support,

I’m trying to convert jpg image to pdf, image was created by a screenshot from smartphone.
When I using autoRotate method, an ArgumentOutOfRangeException was raised (Specified argument was out of the range of valid values.)

ImageToUp.jpg (164.9 KB)

Please find below the snippet :
package com.ideosante.working;

import java.io.FileInputStream;
import java.io.InputStream;

import com.aspose.imaging.fileformats.jpeg.JpegImage;

public class WorkingAsposeImage {
public static void main(String[] args) {
myTest();
}

private static void myTest() {

InputStream in;
try {
  in = new FileInputStream("/home/fmelot/Téléchargements/ImageToUp.jpg");
  JpegImage image = (JpegImage) JpegImage.load(in);
  image.autoRotate();
} catch (Exception e) {
  e.printStackTrace();
}

}
}

Regards,
Florian

@IDO-IN

I have created a ticket with ID IMAGINGJAVA-7755 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

@IDO-IN

We have verified using Aspose.Imaging for Java 21.3 and 21.4 but have not been able to observe issue. Actually, we support following values for Exif.Orientation. The 8 EXIF orientation values are numbered 1 to 8.

1 = 0 degrees: the correct orientation, no adjustment is required.
2 = 0 degrees, mirrored: image has been flipped back-to-front.
3 = 180 degrees: image is upside down.
4 = 180 degrees, mirrored: image has been flipped back-to-front and is upside down.
5 = 90 degrees: image has been flipped back-to-front and is on its side.
6 = 90 degrees, mirrored: image is on its side.
7 = 270 degrees: image has been flipped back-to-front and is on its far side.
8 = 270 degrees, mirrored: image is on its far side.

Any other value will lead to ArgumentOutOfRangeException.