I need to know what orientation has the JPEG file which i read.
jpeg_create_decompress(&cinfo);
jpeg_stdio_src(&cinfo, file);
jpeg_read_header(&cinfo, TRUE);
What shall i do after reading the header? Help please
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The orientation is stored in the EXIF section.
I see two options here:
Use
libexif‘s jpegtools, see for example:https://github.com/kif/imagizer/blob/master/libexiftran/jpegtools.c (look for the
get_orientation()function)or use something like the
get_orientation()function used inhttp://src.gnu-darwin.org/ports/x11-toolkits/gtk20/work/gtk+-2.12.3/gdk-pixbuf/io-jpeg.cto retrieve the orientation from thej_decompress_ptrdirectly. (this is probably the quickest-to-implement solution)