I did something similar. Had to restore lost data from recovered hdd image (corrupted filesystem). All tools generated hundreds of jpg images. But files where actually videos from digital cameras.
In encoder used something like this (one way only).
Code:
void direct_encode_block(Filetype type, FILE *in, int len, Encoder &en, int s1, int s2,int info=-1,int r=0 ) {
printf("\n");
en.compress(type);
en.compress(len>>24);
en.compress(len>>16);
en.compress(len>>8);
en.compress(len);
if (info!=-1) {
en.compress(info>>24);
en.compress(info>>16);
en.compress(info>>8);
en.compress(info);
}
if (level>0) printf("Compressing... ");
static const char* typenames[14]={"default", "jpeg", "hdr",
"1b-image", "4b-image", "8b-image", "24b-image", "audio","mp4",
"exe", "cd", "text","utf-8","base64"};
char b2[32];
//r--;
sprintf(b2,"%d.%s",r,typenames[type]);
FILE* dtmp1=fopen(b2, "wb+");
const int total=s1+len+s2;
for (int j=s1; j<s1+len; ++j) {
if (!(j&0xfff)) printStatus(j, total);
U8 g=getc(in);
en.compress(g);
fputc(g, dtmp1);
}
fclose(dtmp1);
if (level>0) printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
}
r is block number.
Not perfect, kind of stupid solution but did what was needed.