How can I manipulate/rotate a JPEG image in C++?

ぃ、小莉子 提交于 2019-12-14 03:32:26

问题


I'd like to use the compiled libjpeg-9 example.c and transupp.c code and libraries to rotate a .jpg image in an Eclipse project.

Working progress on achieving this from the start: Compiling/using libjpeg in Windows for Eclipse

Trying to integrate do_rot_180 and read/write functions into one location: Need help compiling jpegtran.c code from libjpeg


回答1:


do_rot_180 function in transupp.c in libjpeg (you are aware of it as the Q has the tag) is doing exactly what you want.

LOCAL(void)
do_rot_180 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
        jvirt_barray_ptr *src_coef_arrays,
        jvirt_barray_ptr *dst_coef_arrays)
/* 180 degree rotation is equivalent to
 *   1. Vertical mirroring;
 *   2. Horizontal mirroring.
 * These two steps are merged into a single processing routine.
 */

The function is used by jtransform_execute_transformation/JXFORM_ROT_180 and loslessy reorders JPEG's internals to achieve rotation effect. This function demonstrates the use and rotates a given file and writes a new modified file using specified transformation (angle).




回答2:


Have you get a look at the imagemagick library? it's free and very powerful tool



来源:https://stackoverflow.com/questions/14586759/how-can-i-manipulate-rotate-a-jpeg-image-in-c

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