Lossless JPEG rotation during decoding with libjpeg

帅比萌擦擦* 提交于 2020-01-03 01:20:13

问题


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?


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!