tags:

views:

145

answers:

1

How can you (in C/C++) add text to a jpeg-file using libjpeg?

I do not mean by editing pixels, but by adding text to the meta-data (like the png_set_text() libpng library for png files).

+4  A: 

Never mind, found it:

char *text = "Hello, world!";

jpeg_write_marker(&cinfo, JPEG_COM, (const JOCTET *)text, strlen(text));

(just after jpeg_start_compress)