In the main part, I rotated the image. Then I wrote a code for writing my image to in project file as a jpeg file. I couldn't do it.
Here is my code:
They are some definitions and libraries I used. (I also added standard libraries.)
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
#define CHANNEL_NUM 3
int main() {
.
.
.
write(&out_image); // calling by reference
}
After this part, I want to write my image as a jpg file. So this is the writing part:
int write(unsigned char *rgb_image)
{
int width =400;
int height = 400;
rgb_image = malloc(width*height*CHANNEL_NUM);
stbi_write_jpg("rotated_image", width, height, CHANNEL_NUM, rgb_image, width*CHANNEL_NUM);
return 0;
}
I am not sure about the second part so I share it with you. By the way, I don't get any errors in both functions. (main and write)
If you want the full code, let me know in the comment section. I can share my main function too.