I've got a simple C++ app that decodes JPEGs with libjpeg - however, some of the images it processes come out sideways! These input images have orientations baked in to the EXIF data by the camera, but it seems that during decompression, libjpeg isn't taking the orientation flag into account as many JPEG viewers do.
Is there a way to get libjpeg to respect the orientation of the JPEG during decompression, or will I have to parse out this orientation tag and manually rotate the image?
the transupp.h header in libjpeg defines an API for lossless rotation. Included is also, jpegtran.c, source code for an executable that serves as an example.
来源:https://stackoverflow.com/questions/12802231/lossless-jpeg-rotation-during-decoding-with-libjpeg