I've come across this problem while searching for how to write to a buffer instead of a file and I have trouble finding a good example.
This is what the jpeglib.h says but I'm unsure on how to use this.
/* Data source and destination managers: memory buffers. */
EXTERN(void) jpeg_mem_dest JPP((j_compress_ptr cinfo,
unsigned char ** outbuffer,
unsigned long * outsize));
In the example.c we set the data destination at Step 2 so how would one use this here if we already have a std::vector<unsigned char> buffer
that holds RGB values.
/* Step 2: specify data destination (eg, a file) */
/* Note: steps 2 and 3 can be done in either order. */
jpeg_mem_dest(&cinfo, /*WHAT GOES HERE*/, /*WHAT GOES HERE*/);
After this is done, what changes do we make to Step 5 so that we write in the same buffer where our decompressed RGB values were?
/* Step 5: while (scan lines remain to be written) */
/* jpeg_write_scanlines(...); */
Did I miss something? I really appreciate any help, thank you in advance.
Aucun commentaire:
Enregistrer un commentaire