Created
July 18, 2017 09:16
-
-
Save andy-thomason/f41e62c6e773299811e3354cce2436d2 to your computer and use it in GitHub Desktop.
Extract a thumbnail from a camera JPEG file using libexif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <libexif/exif-loader.h> | |
// Note: no error handling and no cleanup for clarity. | |
int main() | |
{ | |
ExifLoader *loader = exif_loader_new(); | |
exif_loader_write_file(loader, "IMG_20170422_132409.jpg"); | |
ExifData *ed = exif_loader_get_data(loader); | |
ed = exif_loader_get_data(loader); | |
if (ed && ed->data && ed->size) { | |
fwrite(ed->data, 1, ed->size, fopen("thumb.jpg", "wb")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment