Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top