Skip to content

Instantly share code, notes, and snippets.

@rHermes
Created April 30, 2018 15:44
Show Gist options
  • Save rHermes/1c49f55b75f60f998c125c9aafed640a to your computer and use it in GitHub Desktop.
Save rHermes/1c49f55b75f60f998c125c9aafed640a to your computer and use it in GitHub Desktop.
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "stb_image_write.h"
int main() {
int x, y, n;
unsigned char *data = stbi_load("testimage.jpg", &x, &y, &n, 3);
stbi_write_png("out-image.png", x, y, 3, data, x*3);
stbi_image_free(data);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment