blob: 48a18c5de0e3c39c03e99709a9417eaa53e054a7 [file] [log] [blame]
Tyler Chatowe0241452019-03-08 21:07:50 -08001#include "flip_image.h"
2
3#define cimg_display 0
4#define cimg_use_jpeg
5#define cimg_plugin "plugins/jpeg_buffer.h"
6#include "third_party/cimg/CImg.h"
7
8void flip_image(const char *input, const int input_size, JOCTET *buffer,
Austin Schuh9c03a532019-03-17 18:14:45 -07009 unsigned int *buffer_size, bool flip) {
Tyler Chatowe0241452019-03-08 21:07:50 -080010 ::cimg_library::CImg<unsigned char> image;
11 image.load_jpeg_buffer((JOCTET *)(input), input_size);
Austin Schuh9c03a532019-03-17 18:14:45 -070012 if (flip) {
Tyler Chatowd3384c22019-04-04 16:38:32 -070013 image.rotate(90);
14 } else {
15 image.rotate(270);
Austin Schuh9c03a532019-03-17 18:14:45 -070016 }
Tyler Chatowe0241452019-03-08 21:07:50 -080017
18 image.save_jpeg_buffer(buffer, *buffer_size, 80);
19}